Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -229,10 +229,27 @@ def run_market_research(topic: str, progress_container, chat_container):
|
|
| 229 |
update_progress(progress_container, 75, "Generating report...")
|
| 230 |
time.sleep(1)
|
| 231 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 232 |
update_progress(progress_container, 100, "Report completed!")
|
| 233 |
display_agent_message(chat_container, "writer",
|
| 234 |
"✨ Report generation completed! You can now view the full report.")
|
| 235 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 236 |
except Exception as e:
|
| 237 |
st.error(f"Error during research: {str(e)}")
|
| 238 |
|
|
@@ -276,6 +293,64 @@ def main():
|
|
| 276 |
st.error(f"Error generating report: {str(e)}")
|
| 277 |
finally:
|
| 278 |
st.session_state.generating = False
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 279 |
|
| 280 |
if __name__ == "__main__":
|
| 281 |
main()
|
|
|
|
| 229 |
update_progress(progress_container, 75, "Generating report...")
|
| 230 |
time.sleep(1)
|
| 231 |
|
| 232 |
+
# Simulate report data
|
| 233 |
+
report_data = {
|
| 234 |
+
"exec_summary": {
|
| 235 |
+
"summary": "This is a summary of the market research.",
|
| 236 |
+
"market_size": "Market size is estimated to be $1 billion.",
|
| 237 |
+
"growth_rate": "The growth rate is projected at 5% annually.",
|
| 238 |
+
"key_players": "Key players include Company A, Company B, and Company C."
|
| 239 |
+
},
|
| 240 |
+
"detailed_report": "This is the detailed report content.",
|
| 241 |
+
"sources": ["Source 1", "Source 2", "Source 3"]
|
| 242 |
+
}
|
| 243 |
+
|
| 244 |
+
# Update progress and display completion message
|
| 245 |
update_progress(progress_container, 100, "Report completed!")
|
| 246 |
display_agent_message(chat_container, "writer",
|
| 247 |
"✨ Report generation completed! You can now view the full report.")
|
| 248 |
|
| 249 |
+
# Store the report data in session state
|
| 250 |
+
st.session_state.current_report = report_data
|
| 251 |
+
st.session_state.current_topic = topic
|
| 252 |
+
|
| 253 |
except Exception as e:
|
| 254 |
st.error(f"Error during research: {str(e)}")
|
| 255 |
|
|
|
|
| 293 |
st.error(f"Error generating report: {str(e)}")
|
| 294 |
finally:
|
| 295 |
st.session_state.generating = False
|
| 296 |
+
|
| 297 |
+
with tab2:
|
| 298 |
+
if 'current_report' in st.session_state:
|
| 299 |
+
report = st.session_state.current_report
|
| 300 |
+
topic = st.session_state.current_topic
|
| 301 |
+
|
| 302 |
+
# Display AI Disclaimer
|
| 303 |
+
st.markdown("""
|
| 304 |
+
<div class="report-header">
|
| 305 |
+
<strong>⚠️ AI-Generated Report Disclaimer</strong>
|
| 306 |
+
<p>This report was generated using AI agents for market research and analysis.
|
| 307 |
+
While we strive for accuracy, please review all content and verify critical information
|
| 308 |
+
independently. The analysis and recommendations provided should be used as a
|
| 309 |
+
supplementary resource rather than the sole basis for decision-making.</p>
|
| 310 |
+
</div>
|
| 311 |
+
""", unsafe_allow_html=True)
|
| 312 |
+
|
| 313 |
+
# Executive Summary Section
|
| 314 |
+
st.subheader("Executive Summary")
|
| 315 |
+
st.markdown("""
|
| 316 |
+
<div class="exec-summary">
|
| 317 |
+
{}
|
| 318 |
+
|
| 319 |
+
<div class="key-findings">
|
| 320 |
+
<div class="finding-card">
|
| 321 |
+
<h4>Market Size</h4>
|
| 322 |
+
{}
|
| 323 |
+
</div>
|
| 324 |
+
<div class="finding-card">
|
| 325 |
+
<h4>Growth Rate</h4>
|
| 326 |
+
{}
|
| 327 |
+
</div>
|
| 328 |
+
<div class="finding-card">
|
| 329 |
+
<h4>Key Players</h4>
|
| 330 |
+
{}
|
| 331 |
+
</div>
|
| 332 |
+
</div>
|
| 333 |
+
</div>
|
| 334 |
+
""".format(
|
| 335 |
+
report['exec_summary']['summary'],
|
| 336 |
+
report['exec_summary']['market_size'],
|
| 337 |
+
report['exec_summary']['growth_rate'],
|
| 338 |
+
report['exec_summary']['key_players']
|
| 339 |
+
), unsafe_allow_html=True)
|
| 340 |
+
|
| 341 |
+
# Detailed Report Section
|
| 342 |
+
st.subheader("Detailed Report")
|
| 343 |
+
st.markdown(f"""
|
| 344 |
+
<div class="detailed-section">
|
| 345 |
+
{report['detailed_report']}
|
| 346 |
+
</div>
|
| 347 |
+
""", unsafe_allow_html=True)
|
| 348 |
+
|
| 349 |
+
# Sources Section
|
| 350 |
+
if report['sources']:
|
| 351 |
+
st.subheader("Sources")
|
| 352 |
+
for source in report['sources']:
|
| 353 |
+
st.markdown(f"- {source}")
|
| 354 |
|
| 355 |
if __name__ == "__main__":
|
| 356 |
main()
|