Spaces:
Running
Running
update
Browse files
app.py
CHANGED
@@ -17,6 +17,24 @@ PREDEFINED_SOURCES = [
|
|
17 |
"https://ipullrank.com/google-algo-leak"
|
18 |
]
|
19 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
# Function to handle asynchronous calls
|
21 |
def run_async(coroutine):
|
22 |
loop = asyncio.get_event_loop()
|
@@ -41,4 +59,4 @@ if st.button("Generate Report"):
|
|
41 |
fetch_report_coroutine = fetch_report(query, REPORT_TYPE, PREDEFINED_SOURCES)
|
42 |
report = run_async(fetch_report_coroutine)
|
43 |
st.success("Report generated successfully!")
|
44 |
-
st.write(report)
|
|
|
17 |
"https://ipullrank.com/google-algo-leak"
|
18 |
]
|
19 |
|
20 |
+
async def fetch_report(query, report_type, sources):
|
21 |
+
"""
|
22 |
+
Fetch a research report based on the provided query, report type, and sources.
|
23 |
+
This function assumes that `GPTResearcher` has methods to conduct research and write a report.
|
24 |
+
"""
|
25 |
+
# Initialize the researcher with required parameters
|
26 |
+
researcher = GPTResearcher(query=query, report_type=report_type, source_urls=sources)
|
27 |
+
|
28 |
+
# Conduct research
|
29 |
+
await researcher.conduct_research()
|
30 |
+
|
31 |
+
# Write the report after research has been conducted
|
32 |
+
report = await researcher.write_report()
|
33 |
+
|
34 |
+
# Return the completed report
|
35 |
+
return report
|
36 |
+
|
37 |
+
|
38 |
# Function to handle asynchronous calls
|
39 |
def run_async(coroutine):
|
40 |
loop = asyncio.get_event_loop()
|
|
|
59 |
fetch_report_coroutine = fetch_report(query, REPORT_TYPE, PREDEFINED_SOURCES)
|
60 |
report = run_async(fetch_report_coroutine)
|
61 |
st.success("Report generated successfully!")
|
62 |
+
st.write(report)
|