Update app.py
Browse files
app.py
CHANGED
|
@@ -1,5 +1,26 @@
|
|
| 1 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
# AI解析実行
|
| 4 |
res = analyze_news(article)
|
| 5 |
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
import time
|
| 3 |
+
import os
|
| 4 |
+
from news_collector import fetch_rss_news
|
| 5 |
+
from ai_analyst import analyze_news
|
| 6 |
|
| 7 |
+
def run_insight_process(api_key):
|
| 8 |
+
if not api_key:
|
| 9 |
+
yield "❌ エラー: APIキーを入力してください。"
|
| 10 |
+
return
|
| 11 |
+
|
| 12 |
+
os.environ["GEMINI_API_KEY"] = api_key
|
| 13 |
+
log_output = "🚀 解析開始...\n"
|
| 14 |
+
yield log_output
|
| 15 |
+
|
| 16 |
+
try:
|
| 17 |
+
articles = fetch_rss_news()
|
| 18 |
+
top_articles = articles[:5] # 上位5件を解析
|
| 19 |
+
|
| 20 |
+
for i, article in enumerate(top_articles):
|
| 21 |
+
log_output += f"🔍 解析中 ({i+1}/{len(top_articles)}): {article['title']}\n"
|
| 22 |
+
yield log_output
|
| 23 |
+
|
| 24 |
# AI解析実行
|
| 25 |
res = analyze_news(article)
|
| 26 |
|