Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -200,91 +200,92 @@ def main():
|
|
| 200 |
|
| 201 |
with tab2:
|
| 202 |
if 'current_report' in st.session_state:
|
| 203 |
-
|
| 204 |
-
|
|
|
|
| 205 |
|
| 206 |
-
|
| 207 |
-
|
| 208 |
-
|
| 209 |
-
|
| 210 |
-
|
| 211 |
-
|
| 212 |
-
|
| 213 |
-
|
| 214 |
-
<!-- Report Title -->
|
| 215 |
-
<h1 class="section-heading">📊 Market Research Report: {}</h1>
|
| 216 |
-
|
| 217 |
-
<!-- Executive Summary -->
|
| 218 |
-
<div class="report-section executive-summary">
|
| 219 |
-
<h2 class="section-heading">Executive Summary</h2>
|
| 220 |
-
<div class="content-block">{}</div>
|
| 221 |
-
|
| 222 |
-
<h3 class="subsection-heading">Key Market Highlights</h3>
|
| 223 |
-
<div class="content-block">{}</div>
|
| 224 |
-
|
| 225 |
-
<h3 class="subsection-heading">Strategic Implications</h3>
|
| 226 |
-
<div class="content-block">{}</div>
|
| 227 |
|
| 228 |
-
|
| 229 |
-
<
|
| 230 |
-
</div>
|
| 231 |
-
|
| 232 |
-
<!-- Market Analysis -->
|
| 233 |
-
<div class="report-section market-analysis">
|
| 234 |
-
<h2 class="section-heading">Market Analysis</h2>
|
| 235 |
|
| 236 |
-
|
| 237 |
-
<div class="
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 238 |
|
| 239 |
-
|
| 240 |
-
<div class="
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 241 |
|
| 242 |
-
|
| 243 |
-
<div class="
|
|
|
|
|
|
|
|
|
|
| 244 |
|
| 245 |
-
|
| 246 |
-
<div class="
|
| 247 |
-
|
| 248 |
-
|
| 249 |
-
|
| 250 |
-
<div class="report-section future-outlook">
|
| 251 |
-
<h2 class="section-heading">Future Outlook</h2>
|
| 252 |
-
<div class="content-block">{}</div>
|
| 253 |
</div>
|
| 254 |
-
|
| 255 |
-
|
| 256 |
-
|
| 257 |
-
|
| 258 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 259 |
</div>
|
| 260 |
-
|
| 261 |
-
|
| 262 |
-
|
| 263 |
-
|
| 264 |
-
|
| 265 |
-
|
| 266 |
-
report['exec_summary']['recommendations'],
|
| 267 |
-
report['market_analysis']['overview'],
|
| 268 |
-
report['market_analysis']['dynamics'],
|
| 269 |
-
report['market_analysis']['competitive_landscape'],
|
| 270 |
-
report['market_analysis']['strategic_analysis'],
|
| 271 |
-
report['future_outlook'],
|
| 272 |
-
'\n'.join([f'<div class="source-item">• {source}</div>' for source in report['sources']])
|
| 273 |
-
), unsafe_allow_html=True)
|
| 274 |
-
|
| 275 |
-
# Download button with custom styling
|
| 276 |
-
st.markdown("""
|
| 277 |
-
<div style="text-align: center; margin-top: 30px;">
|
| 278 |
-
<button class="download-button" onclick="alert('Use the Streamlit download button below')">
|
| 279 |
-
📥 Download Complete Report
|
| 280 |
-
</button>
|
| 281 |
-
</div>
|
| 282 |
-
""", unsafe_allow_html=True)
|
| 283 |
-
|
| 284 |
-
# Actual download functionality (hidden but functional)
|
| 285 |
-
st.download_button(
|
| 286 |
-
"Download Report",
|
| 287 |
-
data=f"""# Market Research Report: {topic}
|
| 288 |
|
| 289 |
## Executive Summary
|
| 290 |
{report['exec_summary']['summary']}
|
|
@@ -316,17 +317,16 @@ def main():
|
|
| 316 |
{report['future_outlook']}
|
| 317 |
|
| 318 |
## Sources
|
| 319 |
-
{chr(10).join([f"• {source}" for source in report['sources']])}
|
| 320 |
-
""
|
| 321 |
-
|
| 322 |
-
|
| 323 |
-
|
| 324 |
-
|
| 325 |
-
|
| 326 |
except Exception as e:
|
| 327 |
st.error(f"Error displaying report: {str(e)}")
|
| 328 |
st.write("Raw report data:", report) # Debug information
|
| 329 |
-
|
| 330 |
|
| 331 |
if __name__ == "__main__":
|
| 332 |
main()
|
|
|
|
| 200 |
|
| 201 |
with tab2:
|
| 202 |
if 'current_report' in st.session_state:
|
| 203 |
+
try:
|
| 204 |
+
report = st.session_state.current_report
|
| 205 |
+
topic = st.session_state.current_topic
|
| 206 |
|
| 207 |
+
st.markdown("""
|
| 208 |
+
<div class="report-container">
|
| 209 |
+
<!-- AI Disclaimer -->
|
| 210 |
+
<div class="disclaimer">
|
| 211 |
+
⚠️ This report was generated using AI. While we strive for accuracy,
|
| 212 |
+
please verify critical information independently before making decisions.
|
| 213 |
+
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 214 |
|
| 215 |
+
<!-- Report Title -->
|
| 216 |
+
<h1 class="section-heading">📊 Market Research Report: {}</h1>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 217 |
|
| 218 |
+
<!-- Executive Summary -->
|
| 219 |
+
<div class="report-section executive-summary">
|
| 220 |
+
<h2 class="section-heading">Executive Summary</h2>
|
| 221 |
+
<div class="content-block">{}</div>
|
| 222 |
+
|
| 223 |
+
<h3 class="subsection-heading">Key Market Highlights</h3>
|
| 224 |
+
<div class="content-block">{}</div>
|
| 225 |
+
|
| 226 |
+
<h3 class="subsection-heading">Strategic Implications</h3>
|
| 227 |
+
<div class="content-block">{}</div>
|
| 228 |
+
|
| 229 |
+
<h3 class="subsection-heading">Recommendations</h3>
|
| 230 |
+
<div class="content-block">{}</div>
|
| 231 |
+
</div>
|
| 232 |
|
| 233 |
+
<!-- Market Analysis -->
|
| 234 |
+
<div class="report-section market-analysis">
|
| 235 |
+
<h2 class="section-heading">Market Analysis</h2>
|
| 236 |
+
|
| 237 |
+
<h3 class="subsection-heading">Market Overview</h3>
|
| 238 |
+
<div class="content-block">{}</div>
|
| 239 |
+
|
| 240 |
+
<h3 class="subsection-heading">Industry Dynamics</h3>
|
| 241 |
+
<div class="content-block">{}</div>
|
| 242 |
+
|
| 243 |
+
<h3 class="subsection-heading">Competitive Landscape</h3>
|
| 244 |
+
<div class="content-block">{}</div>
|
| 245 |
+
|
| 246 |
+
<h3 class="subsection-heading">Strategic Analysis</h3>
|
| 247 |
+
<div class="content-block">{}</div>
|
| 248 |
+
</div>
|
| 249 |
|
| 250 |
+
<!-- Future Outlook -->
|
| 251 |
+
<div class="report-section future-outlook">
|
| 252 |
+
<h2 class="section-heading">Future Outlook</h2>
|
| 253 |
+
<div class="content-block">{}</div>
|
| 254 |
+
</div>
|
| 255 |
|
| 256 |
+
<!-- Sources -->
|
| 257 |
+
<div class="report-section sources-section">
|
| 258 |
+
<h2 class="section-heading">Sources</h2>
|
| 259 |
+
{}
|
| 260 |
+
</div>
|
|
|
|
|
|
|
|
|
|
| 261 |
</div>
|
| 262 |
+
""".format(
|
| 263 |
+
topic,
|
| 264 |
+
report['exec_summary']['summary'],
|
| 265 |
+
report['exec_summary']['market_highlights'],
|
| 266 |
+
report['exec_summary']['strategic_implications'],
|
| 267 |
+
report['exec_summary']['recommendations'],
|
| 268 |
+
report['market_analysis']['overview'],
|
| 269 |
+
report['market_analysis']['dynamics'],
|
| 270 |
+
report['market_analysis']['competitive_landscape'],
|
| 271 |
+
report['market_analysis']['strategic_analysis'],
|
| 272 |
+
report['future_outlook'],
|
| 273 |
+
'\n'.join([f'<div class="source-item">• {source}</div>' for source in report['sources']])
|
| 274 |
+
), unsafe_allow_html=True)
|
| 275 |
+
|
| 276 |
+
# Download button with custom styling
|
| 277 |
+
st.markdown("""
|
| 278 |
+
<div style="text-align: center; margin-top: 30px;">
|
| 279 |
+
<button class="download-button" onclick="alert('Use the Streamlit download button below')">
|
| 280 |
+
📥 Download Complete Report
|
| 281 |
+
</button>
|
| 282 |
</div>
|
| 283 |
+
""", unsafe_allow_html=True)
|
| 284 |
+
|
| 285 |
+
# Actual download functionality
|
| 286 |
+
st.download_button(
|
| 287 |
+
"Download Report",
|
| 288 |
+
data=f"""# Market Research Report: {topic}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 289 |
|
| 290 |
## Executive Summary
|
| 291 |
{report['exec_summary']['summary']}
|
|
|
|
| 317 |
{report['future_outlook']}
|
| 318 |
|
| 319 |
## Sources
|
| 320 |
+
{chr(10).join([f"• {source}" for source in report['sources']])}""",
|
| 321 |
+
file_name=f"{topic.lower().replace(' ', '_')}_market_research.md",
|
| 322 |
+
mime="text/markdown",
|
| 323 |
+
key='download_button',
|
| 324 |
+
help="Click to download the complete report"
|
| 325 |
+
)
|
| 326 |
+
|
| 327 |
except Exception as e:
|
| 328 |
st.error(f"Error displaying report: {str(e)}")
|
| 329 |
st.write("Raw report data:", report) # Debug information
|
|
|
|
| 330 |
|
| 331 |
if __name__ == "__main__":
|
| 332 |
main()
|