Spaces:
Running
Running
Update app.py
Browse files
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 |
-
#
|
63 |
if st.button("Generate Report"):
|
64 |
if not query:
|
65 |
st.warning("Please enter a query to generate a report.")
|
66 |
else:
|
67 |
-
#
|
68 |
-
|
69 |
-
|
70 |
-
|
|
|
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
|
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,
|