Spaces:
Running
Running
Krish Patel
commited on
Commit
Β·
1196075
1
Parent(s):
085104d
Changed the order of analysis
Browse files
app.py
CHANGED
@@ -196,6 +196,22 @@ def main():
|
|
196 |
# Single expander for all analysis details
|
197 |
with st.expander("Click here to get Detailed Analysis"):
|
198 |
try:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
199 |
# Text Classification
|
200 |
st.subheader("π Text Classification")
|
201 |
text_class = gemini_result.get('text_classification', {})
|
@@ -219,21 +235,6 @@ def main():
|
|
219 |
st.write("People:", ", ".join(entities.get('people', ['N/A'])))
|
220 |
st.write("Organizations:", ", ".join(entities.get('organizations', ['N/A'])))
|
221 |
|
222 |
-
# Named Entities from spaCy
|
223 |
-
st.subheader("π·οΈ Named Entities")
|
224 |
-
entities = extract_entities(news_text, nlp)
|
225 |
-
df = pd.DataFrame(entities, columns=["Entity", "Type"])
|
226 |
-
st.dataframe(df)
|
227 |
-
|
228 |
-
# Knowledge Graph Visualization
|
229 |
-
st.subheader("πΈοΈ Knowledge Graph")
|
230 |
-
fig = generate_knowledge_graph_viz(news_text, nlp, tokenizer, model)
|
231 |
-
st.plotly_chart(fig, use_container_width=True)
|
232 |
-
|
233 |
-
# Analysis Reasoning
|
234 |
-
st.subheader("π Analysis Reasoning")
|
235 |
-
for point in gemini_result.get('gemini_analysis', {}).get('reasoning', ['N/A']):
|
236 |
-
st.write(f"β’ {point}")
|
237 |
|
238 |
except Exception as e:
|
239 |
st.error("Error processing analysis results")
|
|
|
196 |
# Single expander for all analysis details
|
197 |
with st.expander("Click here to get Detailed Analysis"):
|
198 |
try:
|
199 |
+
# Named Entities from spaCy
|
200 |
+
st.subheader("π·οΈ Named Entities")
|
201 |
+
entities = extract_entities(news_text, nlp)
|
202 |
+
df = pd.DataFrame(entities, columns=["Entity", "Type"])
|
203 |
+
st.dataframe(df)
|
204 |
+
|
205 |
+
# Knowledge Graph Visualization
|
206 |
+
st.subheader("πΈοΈ Knowledge Graph")
|
207 |
+
fig = generate_knowledge_graph_viz(news_text, nlp, tokenizer, model)
|
208 |
+
st.plotly_chart(fig, use_container_width=True)
|
209 |
+
|
210 |
+
# Analysis Reasoning
|
211 |
+
st.subheader("π Analysis Reasoning")
|
212 |
+
for point in gemini_result.get('gemini_analysis', {}).get('reasoning', ['N/A']):
|
213 |
+
st.write(f"β’ {point}")
|
214 |
+
|
215 |
# Text Classification
|
216 |
st.subheader("π Text Classification")
|
217 |
text_class = gemini_result.get('text_classification', {})
|
|
|
235 |
st.write("People:", ", ".join(entities.get('people', ['N/A'])))
|
236 |
st.write("Organizations:", ", ".join(entities.get('organizations', ['N/A'])))
|
237 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
238 |
|
239 |
except Exception as e:
|
240 |
st.error("Error processing analysis results")
|