Spaces:
Sleeping
Sleeping
Commit ·
caf116e
1
Parent(s): b163a8c
Upload Deep Research AI application files
Browse files- app.py +45 -0
- deep_research.py +0 -0
- requirements.txt +0 -0
app.py
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import uuid
|
| 2 |
+
import traceback
|
| 3 |
+
import streamlit as st
|
| 4 |
+
from deep_research import run_deep_research_system
|
| 5 |
+
|
| 6 |
+
st.set_page_config(page_title="Deep Research AI", layout="centered")
|
| 7 |
+
|
| 8 |
+
if "question" not in st.session_state:
|
| 9 |
+
st.session_state.question = ""
|
| 10 |
+
if "show_result" not in st.session_state:
|
| 11 |
+
st.session_state.show_result = False
|
| 12 |
+
if "input_key" not in st.session_state:
|
| 13 |
+
st.session_state.input_key = str(uuid.uuid4())
|
| 14 |
+
|
| 15 |
+
st.title("Deep Research AI Agentic System")
|
| 16 |
+
st.write("Enter a question below to get the latest insights from web research. Click 'Reset' to start over.")
|
| 17 |
+
|
| 18 |
+
st.session_state.question = st.text_input(
|
| 19 |
+
"Your Question",
|
| 20 |
+
value=st.session_state.question,
|
| 21 |
+
placeholder="e.g., What are the latest advancements in quantum computing?",
|
| 22 |
+
key=st.session_state.input_key
|
| 23 |
+
)
|
| 24 |
+
|
| 25 |
+
if st.button("Get Answer"):
|
| 26 |
+
if st.session_state.question.strip() != "":
|
| 27 |
+
st.session_state.show_result = True
|
| 28 |
+
st.write(f"Research Agent: Searching for '{st.session_state.question}'...")
|
| 29 |
+
try:
|
| 30 |
+
with st.spinner("Gathering research data..."):
|
| 31 |
+
answer = run_deep_research_system(st.session_state.question)
|
| 32 |
+
st.success("Research complete! Answer Drafter Agent: Drafted the final answer.")
|
| 33 |
+
st.markdown("**Final Answer:**")
|
| 34 |
+
st.write(answer)
|
| 35 |
+
except Exception as e:
|
| 36 |
+
st.error(f"An error occurred: {str(e)}\n{traceback.format_exc()}")
|
| 37 |
+
else:
|
| 38 |
+
st.warning("Please enter a question!")
|
| 39 |
+
|
| 40 |
+
if st.session_state.show_result:
|
| 41 |
+
if st.button("Reset"):
|
| 42 |
+
st.session_state.question = ""
|
| 43 |
+
st.session_state.show_result = False
|
| 44 |
+
st.session_state.input_key = str(uuid.uuid4())
|
| 45 |
+
st.rerun()
|
deep_research.py
ADDED
|
File without changes
|
requirements.txt
ADDED
|
File without changes
|