Update app.py
Browse files
app.py
CHANGED
|
@@ -92,17 +92,18 @@ def analyze_news(search_type, search_input, num_articles):
|
|
| 92 |
s_emoji = get_sentiment_color(result['sentiment'])
|
| 93 |
i_emoji = get_impact_color(result.get('impact', 'N/A'))
|
| 94 |
|
| 95 |
-
# --- MODIFIED:
|
| 96 |
detailed_results += f"""### {i}. {s_emoji} {result['title']}
|
| 97 |
**Theme:** {result.get('theme', 'N/A')} | **Impact:** {i_emoji} {result.get('impact', 'N/A')}
|
| 98 |
**Sentiment:** {result['sentiment']} | **Score:** {result['score']:.2f}
|
| 99 |
**เผยแพร่:** {result['published']}
|
| 100 |
-
|
| 101 |
-
|
| 102 |
[🔗 อ่านต่อ]({result['link']})
|
| 103 |
---"""
|
|
|
|
| 104 |
|
| 105 |
-
# Create DataFrame for table view
|
| 106 |
df_data = []
|
| 107 |
for result in results:
|
| 108 |
df_data.append({
|
|
@@ -124,7 +125,7 @@ def analyze_news(search_type, search_input, num_articles):
|
|
| 124 |
error_msg = f"❌ เกิดข้อผิดพลาด: {str(e)}"
|
| 125 |
yield error_msg, None, error_msg
|
| 126 |
|
| 127 |
-
#
|
| 128 |
with gr.Blocks(title="Yahoo Finance News Analyzer", theme=gr.themes.Soft()) as demo:
|
| 129 |
gr.Markdown("""
|
| 130 |
# 📈 Yahoo Finance News Analyzer
|
|
|
|
| 92 |
s_emoji = get_sentiment_color(result['sentiment'])
|
| 93 |
i_emoji = get_impact_color(result.get('impact', 'N/A'))
|
| 94 |
|
| 95 |
+
# --- MODIFIED: Reverted to *exact* original format + added Theme/Impact line ---
|
| 96 |
detailed_results += f"""### {i}. {s_emoji} {result['title']}
|
| 97 |
**Theme:** {result.get('theme', 'N/A')} | **Impact:** {i_emoji} {result.get('impact', 'N/A')}
|
| 98 |
**Sentiment:** {result['sentiment']} | **Score:** {result['score']:.2f}
|
| 99 |
**เผยแพร่:** {result['published']}
|
| 100 |
+
**คำอธิบาย:** {result['explanation']}
|
| 101 |
+
{result['summary'][:200]}{'...' if len(result['summary']) > 200 else ''}
|
| 102 |
[🔗 อ่านต่อ]({result['link']})
|
| 103 |
---"""
|
| 104 |
+
# --- End of MODIFIED block ---
|
| 105 |
|
| 106 |
+
# Create DataFrame for table view (Keeping new columns as they are useful)
|
| 107 |
df_data = []
|
| 108 |
for result in results:
|
| 109 |
df_data.append({
|
|
|
|
| 125 |
error_msg = f"❌ เกิดข้อผิดพลาด: {str(e)}"
|
| 126 |
yield error_msg, None, error_msg
|
| 127 |
|
| 128 |
+
# --- UI Interface (No changes needed, keeping original titles/markdown) ---
|
| 129 |
with gr.Blocks(title="Yahoo Finance News Analyzer", theme=gr.themes.Soft()) as demo:
|
| 130 |
gr.Markdown("""
|
| 131 |
# 📈 Yahoo Finance News Analyzer
|