Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -13,7 +13,7 @@ load_dotenv()
|
|
| 13 |
# Set page config
|
| 14 |
st.set_page_config(
|
| 15 |
page_title="Market Research Generator",
|
| 16 |
-
page_icon="
|
| 17 |
layout="wide",
|
| 18 |
initial_sidebar_state="expanded"
|
| 19 |
)
|
|
@@ -226,8 +226,7 @@ def run_market_research(topic: str, progress_container, chat_container, log_cont
|
|
| 226 |
# Step 2: Gathering market data
|
| 227 |
update_progress(progress_container, 25, "Gathering market data...")
|
| 228 |
log_agent_activity("Research Analyst", f"Beginning comprehensive research on {topic}")
|
| 229 |
-
|
| 230 |
-
f"Starting comprehensive research on {topic}...")
|
| 231 |
log_agent_activity("Research Analyst", "Collecting market size data...")
|
| 232 |
time.sleep(1)
|
| 233 |
log_agent_activity("Research Analyst", "Analyzing competitive landscape...")
|
|
@@ -238,8 +237,7 @@ def run_market_research(topic: str, progress_container, chat_container, log_cont
|
|
| 238 |
# Step 3: Analyzing findings
|
| 239 |
update_progress(progress_container, 50, "Analyzing findings...")
|
| 240 |
log_agent_activity("Data Analyst", "Beginning data analysis phase")
|
| 241 |
-
|
| 242 |
-
"Processing research data and identifying key insights...")
|
| 243 |
log_agent_activity("Data Analyst", "Processing market size metrics...")
|
| 244 |
time.sleep(1)
|
| 245 |
log_agent_activity("Data Analyst", "Calculating growth rates...")
|
|
@@ -250,8 +248,7 @@ def run_market_research(topic: str, progress_container, chat_container, log_cont
|
|
| 250 |
# Step 4: Compiling final report
|
| 251 |
update_progress(progress_container, 75, "Compiling final report...")
|
| 252 |
log_agent_activity("Report Writer", "Starting report compilation")
|
| 253 |
-
|
| 254 |
-
"Compiling final report with executive summary and detailed analysis...")
|
| 255 |
log_agent_activity("Report Writer", "Creating executive summary...")
|
| 256 |
time.sleep(1)
|
| 257 |
log_agent_activity("Report Writer", "Drafting detailed analysis...")
|
|
@@ -269,10 +266,6 @@ def run_market_research(topic: str, progress_container, chat_container, log_cont
|
|
| 269 |
# Format and process the result
|
| 270 |
report_data = format_json_output(result)
|
| 271 |
|
| 272 |
-
# Add visualizations
|
| 273 |
-
charts = generate_visualizations(report_data)
|
| 274 |
-
report_data['charts'] = charts
|
| 275 |
-
|
| 276 |
update_progress(progress_container, 100, "Report completed!")
|
| 277 |
st.success("✨ Report generation completed! You can now view the full report.")
|
| 278 |
log_agent_activity("System", "Report generation completed!")
|
|
@@ -445,4 +438,11 @@ def format_json_output(raw_output):
|
|
| 445 |
"metrics": {
|
| 446 |
"market_size_data": [],
|
| 447 |
"growth_rates": [],
|
| 448 |
-
"market_shares":
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
# Set page config
|
| 14 |
st.set_page_config(
|
| 15 |
page_title="Market Research Generator",
|
| 16 |
+
page_icon="📈",
|
| 17 |
layout="wide",
|
| 18 |
initial_sidebar_state="expanded"
|
| 19 |
)
|
|
|
|
| 226 |
# Step 2: Gathering market data
|
| 227 |
update_progress(progress_container, 25, "Gathering market data...")
|
| 228 |
log_agent_activity("Research Analyst", f"Beginning comprehensive research on {topic}")
|
| 229 |
+
time.sleep(1)
|
|
|
|
| 230 |
log_agent_activity("Research Analyst", "Collecting market size data...")
|
| 231 |
time.sleep(1)
|
| 232 |
log_agent_activity("Research Analyst", "Analyzing competitive landscape...")
|
|
|
|
| 237 |
# Step 3: Analyzing findings
|
| 238 |
update_progress(progress_container, 50, "Analyzing findings...")
|
| 239 |
log_agent_activity("Data Analyst", "Beginning data analysis phase")
|
| 240 |
+
time.sleep(1)
|
|
|
|
| 241 |
log_agent_activity("Data Analyst", "Processing market size metrics...")
|
| 242 |
time.sleep(1)
|
| 243 |
log_agent_activity("Data Analyst", "Calculating growth rates...")
|
|
|
|
| 248 |
# Step 4: Compiling final report
|
| 249 |
update_progress(progress_container, 75, "Compiling final report...")
|
| 250 |
log_agent_activity("Report Writer", "Starting report compilation")
|
| 251 |
+
time.sleep(1)
|
|
|
|
| 252 |
log_agent_activity("Report Writer", "Creating executive summary...")
|
| 253 |
time.sleep(1)
|
| 254 |
log_agent_activity("Report Writer", "Drafting detailed analysis...")
|
|
|
|
| 266 |
# Format and process the result
|
| 267 |
report_data = format_json_output(result)
|
| 268 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 269 |
update_progress(progress_container, 100, "Report completed!")
|
| 270 |
st.success("✨ Report generation completed! You can now view the full report.")
|
| 271 |
log_agent_activity("System", "Report generation completed!")
|
|
|
|
| 438 |
"metrics": {
|
| 439 |
"market_size_data": [],
|
| 440 |
"growth_rates": [],
|
| 441 |
+
"market_shares": []
|
| 442 |
+
}
|
| 443 |
+
}
|
| 444 |
+
except Exception as e:
|
| 445 |
+
st.error(f"Error formatting output: {str(e)}")
|
| 446 |
+
|
| 447 |
+
if __name__ == "__main__":
|
| 448 |
+
main()
|