Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -11,32 +11,25 @@ tavily_api_key = st.secrets["TAVILY_API_KEY"]
|
|
| 11 |
nest_asyncio.apply()
|
| 12 |
|
| 13 |
# Constants
|
| 14 |
-
REPORT_TYPE = "research_report" #
|
| 15 |
-
|
|
|
|
|
|
|
|
|
|
| 16 |
|
| 17 |
# Function to handle asynchronous calls
|
| 18 |
def run_async(coroutine):
|
| 19 |
loop = asyncio.get_event_loop()
|
| 20 |
return loop.run_until_complete(coroutine)
|
| 21 |
|
| 22 |
-
|
| 23 |
# Streamlit interface
|
| 24 |
-
st.title("
|
| 25 |
|
| 26 |
-
# User
|
| 27 |
query = st.text_input(
|
| 28 |
"Enter your research query:",
|
| 29 |
-
"Extract all the information about how the ranking for internal links works."
|
| 30 |
)
|
| 31 |
-
report_type = st.selectbox(
|
| 32 |
-
"Select report type:",
|
| 33 |
-
options=["research_report", "summary", "detailed_analysis"],
|
| 34 |
-
index=0,
|
| 35 |
-
)
|
| 36 |
-
sources = st.text_area("Enter source URLs (one per line if multiple):")
|
| 37 |
-
|
| 38 |
-
# Processing the sources input into a list
|
| 39 |
-
source_urls = [url.strip() for url in sources.split("\n") if url.strip()]
|
| 40 |
|
| 41 |
# Button to generate report
|
| 42 |
if st.button("Generate Report"):
|
|
@@ -44,10 +37,8 @@ if st.button("Generate Report"):
|
|
| 44 |
st.warning("Please enter a query to generate a report.")
|
| 45 |
else:
|
| 46 |
with st.spinner("Generating report..."):
|
| 47 |
-
# Fetch the report asynchronously
|
| 48 |
-
fetch_report_coroutine = fetch_report(
|
| 49 |
-
query, report_type, source_urls if source_urls else None
|
| 50 |
-
)
|
| 51 |
report = run_async(fetch_report_coroutine)
|
| 52 |
st.success("Report generated successfully!")
|
| 53 |
st.write(report)
|
|
|
|
| 11 |
nest_asyncio.apply()
|
| 12 |
|
| 13 |
# Constants
|
| 14 |
+
REPORT_TYPE = "research_report" # Fixed report type
|
| 15 |
+
PREDEFINED_SOURCES = [
|
| 16 |
+
"https://hexdocs.pm/google_api_content_warehouse/",
|
| 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()
|
| 23 |
return loop.run_until_complete(coroutine)
|
| 24 |
|
|
|
|
| 25 |
# Streamlit interface
|
| 26 |
+
st.title("Google Leak Reporting Tool")
|
| 27 |
|
| 28 |
+
# User input for the query
|
| 29 |
query = st.text_input(
|
| 30 |
"Enter your research query:",
|
| 31 |
+
"Extract all the information about how the ranking for internal links works."
|
| 32 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
|
| 34 |
# Button to generate report
|
| 35 |
if st.button("Generate Report"):
|
|
|
|
| 37 |
st.warning("Please enter a query to generate a report.")
|
| 38 |
else:
|
| 39 |
with st.spinner("Generating report..."):
|
| 40 |
+
# Fetch the report asynchronously using predefined sources and fixed report type
|
| 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)
|