Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -93,9 +93,7 @@ with st.expander("Why Use GPT Researcher?", expanded=False):
|
|
| 93 |
For more details, visit the [GPT Researcher GitHub repository](https://github.com/assafelovic/gpt-researcher).
|
| 94 |
""")
|
| 95 |
|
| 96 |
-
#
|
| 97 |
-
|
| 98 |
-
|
| 99 |
st.markdown(
|
| 100 |
"""
|
| 101 |
<style>
|
|
@@ -114,7 +112,6 @@ st.markdown(
|
|
| 114 |
)
|
| 115 |
|
| 116 |
st.markdown('<p class="big-green-font">Enter your research query:</p>', unsafe_allow_html=True)
|
| 117 |
-
#query = st.text_input("", "Why is the Stock Price of Nvidia Soaring? Current Date is September 2024", help="Type your research question or topic.")
|
| 118 |
|
| 119 |
# Display the input field for the user
|
| 120 |
user_query = st.text_input("", "Why is the Stock Price of Nvidia Soaring?", help="Type your research question or topic.")
|
|
@@ -124,9 +121,9 @@ if user_query:
|
|
| 124 |
current_date = datetime.now().strftime("%B %Y")
|
| 125 |
final_query = f"{user_query} Current Date is {current_date}"
|
| 126 |
|
| 127 |
-
# Use final_query for further processing
|
| 128 |
-
st.write(
|
| 129 |
-
|
| 130 |
|
| 131 |
with st.sidebar.expander("How to Use", expanded=False):
|
| 132 |
st.markdown("""
|
|
@@ -141,7 +138,6 @@ with st.sidebar.expander("How to Use", expanded=False):
|
|
| 141 |
with st.sidebar:
|
| 142 |
st.markdown("### Research Settings")
|
| 143 |
research_type = st.selectbox("Select research type:", ["Web Research", "Document Research"], help="Choose between web-based research or research from local documents.")
|
| 144 |
-
#query = st.text_input("Enter your research query:", "What is the Latest in Investing using AI?", help="Type your research question or topic.")
|
| 145 |
report_type = st.selectbox("Select report type:", ["research_report", "resource_list", "article_outline"], help="Choose the format of the final report.")
|
| 146 |
|
| 147 |
if research_type == "Web Research":
|
|
@@ -158,7 +154,7 @@ with st.sidebar:
|
|
| 158 |
f.write(uploaded_file.getbuffer())
|
| 159 |
|
| 160 |
if st.button("Run Research"):
|
| 161 |
-
if not
|
| 162 |
st.warning("Please enter a research query.")
|
| 163 |
else:
|
| 164 |
# Set the retriever environment variable (using Tavily in this case)
|
|
@@ -167,8 +163,8 @@ with st.sidebar:
|
|
| 167 |
report_source = 'local' if research_type == "Document Research" else 'web'
|
| 168 |
|
| 169 |
with st.spinner("Running research..."):
|
| 170 |
-
# Run the research and get the report and logs
|
| 171 |
-
report, logs = asyncio.run(get_report(
|
| 172 |
st.session_state.report = report
|
| 173 |
st.session_state.logs = logs
|
| 174 |
|
|
@@ -196,6 +192,7 @@ if 'logs' in st.session_state:
|
|
| 196 |
else:
|
| 197 |
st.text_area("Logs will appear here during the research process.", height=200)
|
| 198 |
|
|
|
|
| 199 |
hide_streamlit_style = """
|
| 200 |
<style>
|
| 201 |
#MainMenu {visibility: hidden;}
|
|
|
|
| 93 |
For more details, visit the [GPT Researcher GitHub repository](https://github.com/assafelovic/gpt-researcher).
|
| 94 |
""")
|
| 95 |
|
| 96 |
+
# Custom CSS for styling the input label
|
|
|
|
|
|
|
| 97 |
st.markdown(
|
| 98 |
"""
|
| 99 |
<style>
|
|
|
|
| 112 |
)
|
| 113 |
|
| 114 |
st.markdown('<p class="big-green-font">Enter your research query:</p>', unsafe_allow_html=True)
|
|
|
|
| 115 |
|
| 116 |
# Display the input field for the user
|
| 117 |
user_query = st.text_input("", "Why is the Stock Price of Nvidia Soaring?", help="Type your research question or topic.")
|
|
|
|
| 121 |
current_date = datetime.now().strftime("%B %Y")
|
| 122 |
final_query = f"{user_query} Current Date is {current_date}"
|
| 123 |
|
| 124 |
+
# Use final_query for further processing without displaying it
|
| 125 |
+
# Example: st.write("Processing your query...")
|
| 126 |
+
# The processed final_query will be used downstream in the application.
|
| 127 |
|
| 128 |
with st.sidebar.expander("How to Use", expanded=False):
|
| 129 |
st.markdown("""
|
|
|
|
| 138 |
with st.sidebar:
|
| 139 |
st.markdown("### Research Settings")
|
| 140 |
research_type = st.selectbox("Select research type:", ["Web Research", "Document Research"], help="Choose between web-based research or research from local documents.")
|
|
|
|
| 141 |
report_type = st.selectbox("Select report type:", ["research_report", "resource_list", "article_outline"], help="Choose the format of the final report.")
|
| 142 |
|
| 143 |
if research_type == "Web Research":
|
|
|
|
| 154 |
f.write(uploaded_file.getbuffer())
|
| 155 |
|
| 156 |
if st.button("Run Research"):
|
| 157 |
+
if not user_query:
|
| 158 |
st.warning("Please enter a research query.")
|
| 159 |
else:
|
| 160 |
# Set the retriever environment variable (using Tavily in this case)
|
|
|
|
| 163 |
report_source = 'local' if research_type == "Document Research" else 'web'
|
| 164 |
|
| 165 |
with st.spinner("Running research..."):
|
| 166 |
+
# Run the research and get the report and logs using the final_query
|
| 167 |
+
report, logs = asyncio.run(get_report(final_query, report_type, sources, report_source))
|
| 168 |
st.session_state.report = report
|
| 169 |
st.session_state.logs = logs
|
| 170 |
|
|
|
|
| 192 |
else:
|
| 193 |
st.text_area("Logs will appear here during the research process.", height=200)
|
| 194 |
|
| 195 |
+
# Hide Streamlit's default footer and menu
|
| 196 |
hide_streamlit_style = """
|
| 197 |
<style>
|
| 198 |
#MainMenu {visibility: hidden;}
|