Krish Patel commited on
Commit
7a8ca1c
Β·
1 Parent(s): 9963876
Files changed (1) hide show
  1. app.py +38 -30
app.py CHANGED
@@ -165,36 +165,44 @@ def main():
165
 
166
  # Detailed analysis sections
167
  with st.expander("View Detailed Analysis"):
168
- # Text Classification
169
- st.subheader("Text Classification")
170
- st.write(f"Category: {gemini_result['text_classification']['category']}")
171
- st.write(f"Writing Style: {gemini_result['text_classification']['writing_style']}")
172
- st.write(f"Target Audience: {gemini_result['text_classification']['target_audience']}")
173
- st.write(f"Content Type: {gemini_result['text_classification']['content_type']}")
174
-
175
- # Sentiment Analysis
176
- st.subheader("Sentiment Analysis")
177
- st.write(f"Primary Emotion: {gemini_result['sentiment_analysis']['primary_emotion']}")
178
- st.write(f"Emotional Intensity: {gemini_result['sentiment_analysis']['emotional_intensity']}/10")
179
- st.write(f"Sensationalism Level: {gemini_result['sentiment_analysis']['sensationalism_level']}")
180
-
181
- # Entity Recognition
182
- st.subheader("Entity Recognition")
183
- st.write(f"Source Credibility: {gemini_result['entity_recognition']['source_credibility']}")
184
- st.write("Key People:", ", ".join(gemini_result['entity_recognition']['people']))
185
- st.write("Organizations:", ", ".join(gemini_result['entity_recognition']['organizations']))
186
-
187
- # Context & Claims
188
- st.subheader("Context & Claims")
189
- st.write("Main Narrative:", gemini_result['context']['main_narrative'])
190
- st.write("Key Claims:")
191
- for claim in gemini_result['fact_checking']['verifiable_claims']:
192
- st.write(f"β€’ {claim}")
193
-
194
- # Reasoning
195
- st.subheader("Analysis Reasoning")
196
- for point in gemini_result['gemini_analysis']['reasoning']:
197
- st.write(f"β€’ {point}")
 
 
 
 
 
 
 
 
198
 
199
 
200
  with st.expander("Named Entities"):
 
165
 
166
  # Detailed analysis sections
167
  with st.expander("View Detailed Analysis"):
168
+ try:
169
+ # Text Classification
170
+ st.subheader("πŸ“ Text Classification")
171
+ text_class = gemini_result.get('text_classification', {})
172
+ st.write(f"Category: {text_class.get('category', 'N/A')}")
173
+ st.write(f"Writing Style: {text_class.get('writing_style', 'N/A')}")
174
+ st.write(f"Target Audience: {text_class.get('target_audience', 'N/A')}")
175
+ st.write(f"Content Type: {text_class.get('content_type', 'N/A')}")
176
+
177
+ # Sentiment Analysis
178
+ st.subheader("🎭 Sentiment Analysis")
179
+ sentiment = gemini_result.get('sentiment_analysis', {})
180
+ st.write(f"Primary Emotion: {sentiment.get('primary_emotion', 'N/A')}")
181
+ st.write(f"Emotional Intensity: {sentiment.get('emotional_intensity', 'N/A')}/10")
182
+ st.write(f"Sensationalism Level: {sentiment.get('sensationalism_level', 'N/A')}")
183
+
184
+ # Entity Recognition
185
+ st.subheader("πŸ” Entity Recognition")
186
+ entities = gemini_result.get('entity_recognition', {})
187
+ st.write(f"Source Credibility: {entities.get('source_credibility', 'N/A')}")
188
+ st.write("Key People:", ", ".join(entities.get('people', ['N/A'])))
189
+ st.write("Organizations:", ", ".join(entities.get('organizations', ['N/A'])))
190
+
191
+ # Context & Claims
192
+ st.subheader("πŸ“Š Context & Claims")
193
+ context = gemini_result.get('context', {})
194
+ st.write("Main Narrative:", context.get('main_narrative', 'N/A'))
195
+ st.write("Key Claims:")
196
+ for claim in gemini_result.get('fact_checking', {}).get('verifiable_claims', ['N/A']):
197
+ st.write(f"β€’ {claim}")
198
+
199
+ # Reasoning
200
+ st.subheader("πŸ’­ Analysis Reasoning")
201
+ for point in gemini_result.get('gemini_analysis', {}).get('reasoning', ['N/A']):
202
+ st.write(f"β€’ {point}")
203
+
204
+ except Exception as e:
205
+ st.error("Error processing Gemini analysis results")
206
 
207
 
208
  with st.expander("Named Entities"):