cyberandy commited on
Commit
5229ff8
·
verified ·
1 Parent(s): a1d082f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -7
app.py CHANGED
@@ -58,22 +58,26 @@ query = st.text_area(
58
  height=150 # You can adjust the height as needed
59
  )
60
 
 
 
 
61
 
62
- # Button to generate report
63
  if st.button("Generate Report"):
64
  if not query:
65
  st.warning("Please enter a query to generate a report.")
66
  else:
67
- # Collapsible expander to show progress
68
- with st.expander("See research progress"):
69
- with st_capture(st.write):
70
- report = run_async(fetch_report(query, "research_report"))
 
71
 
72
  if report:
73
  st.success("Report generated successfully!")
74
  st.write(report) # Display the report in the app
75
-
76
- # Create a download button and provide the report as a downloadable file
77
  st.download_button(
78
  label="Download Report as Text File",
79
  data=report,
 
58
  height=150 # You can adjust the height as needed
59
  )
60
 
61
+ # Placeholder for the progress expander
62
+ progress_expander = st.expander("See research progress", expanded=True)
63
+ progress_placeholder = progress_expander.empty()
64
 
65
+ # Start the report generation process
66
  if st.button("Generate Report"):
67
  if not query:
68
  st.warning("Please enter a query to generate a report.")
69
  else:
70
+ # Start an asynchronous task for generating the report
71
+ progress_placeholder.info("Starting research...")
72
+ # Run the research asynchronously and capture output
73
+ with st_redirect(progress_placeholder.code):
74
+ report = run_async(fetch_report(query, REPORT_TYPE))
75
 
76
  if report:
77
  st.success("Report generated successfully!")
78
  st.write(report) # Display the report in the app
79
+
80
+ # Create a download button for the report
81
  st.download_button(
82
  label="Download Report as Text File",
83
  data=report,