Spaces:
Sleeping
Sleeping
| 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") | |