AutoReasearcher / app.py
Ani14's picture
Update app.py
3e7ca50 verified
raw
history blame
1.38 kB
import streamlit as st
from gpt_researcher.agent import GPTResearcher
st.set_page_config(page_title="GPT Researcher UI", layout="wide")
st.title("πŸ€– GPT Researcher β€” Streamlit UI")
# --- Sidebar inputs ---
with st.sidebar:
st.header("🧠 Research Configuration")
topic = st.text_input("πŸ’‘ Research Topic", "AI in climate change")
report_type = st.selectbox("πŸ“„ Report Type", ["summary", "detailed", "academic"])
report_format = st.selectbox("πŸ“œ Format", ["markdown", "text"])
report_source = st.selectbox("🌐 Sources", ["web", "arxiv", "semantic-scholar", "hybrid"])
tone = st.selectbox("🎯 Tone", ["objective", "persuasive", "informative"])
start = st.button("πŸš€ Start Research")
# --- Run GPTResearcher ---
if start and topic:
st.markdown("### ⏳ Running Autonomous Research Agent...")
with st.spinner("Gathering knowledge, synthesizing insights..."):
agent = GPTResearcher(
query=topic,
report_type=report_type,
report_format=report_format,
report_source=report_source,
tone=tone
)
output = agent.run()
st.success("βœ… Research Complete!")
st.markdown("### πŸ“„ Final Report")
st.markdown(output, unsafe_allow_html=True)
st.download_button("πŸ’Ύ Download Markdown", output, file_name="report.md", mime="text/markdown")