Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -224,15 +224,15 @@ def run_analysis():
|
|
| 224 |
with open(template_path, encoding='utf-8') as f:
|
| 225 |
html_template = f.read()
|
| 226 |
|
| 227 |
-
|
| 228 |
-
|
| 229 |
-
|
| 230 |
-
|
| 231 |
-
|
| 232 |
-
|
| 233 |
-
|
| 234 |
-
|
| 235 |
-
|
| 236 |
return html_content
|
| 237 |
|
| 238 |
except Exception:
|
|
|
|
| 224 |
with open(template_path, encoding='utf-8') as f:
|
| 225 |
html_template = f.read()
|
| 226 |
|
| 227 |
+
template = Template(html_template)
|
| 228 |
+
html_content = template.render(
|
| 229 |
+
report_date=datetime.now().strftime('%Y-%m-%d %H:%M'),
|
| 230 |
+
engagement_table=engagement_table if engagement_table else "<p>未提供互動數據</p>",
|
| 231 |
+
news_summary=news_summary if news_summary else "<p>未提供新聞摘要</p>",
|
| 232 |
+
news_table=news_table if news_table else "<p>未提供新聞資料</p>",
|
| 233 |
+
**charts
|
| 234 |
+
)
|
| 235 |
+
|
| 236 |
return html_content
|
| 237 |
|
| 238 |
except Exception:
|