Spaces:
Sleeping
Sleeping
File size: 2,346 Bytes
19a1c99 d2e133b adcd64b d2e133b adcd64b d2e133b adcd64b b1c9e6b adcd64b | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 | import streamlit as st
from paper import (
literature_research_task, outline_task, draft_writing_task,
citation_task, editing_task, chatbot_task,
run_task
)
st.set_page_config(
page_title="π Academic Research Assistant",
layout="wide",
initial_sidebar_state="expanded"
)
st.title("π Academic Research & Writing Assistant")
st.markdown(
"""
Welcome to your AI-powered academic assistant! Choose a task from the sidebar,
enter your topic and keywords, and let the agents do the rest.
"""
)
st.sidebar.header("π§ Task Selector")
task_choice = st.sidebar.radio(
"Select an academic task to perform:",
[
"Literature Review",
"Generate Paper Outline",
"Write Draft",
"Generate Citations",
"Edit Draft",
"Ask Chatbot"
]
)
task_map = {
"Literature Review": literature_research_task,
"Generate Paper Outline": outline_task,
"Write Draft": draft_writing_task,
"Generate Citations": citation_task,
"Edit Draft": editing_task,
"Ask Chatbot": chatbot_task,
}
st.subheader("π Input Details")
topic = st.text_input("Enter your research topic:", placeholder="e.g. Impact of AI in Healthcare")
keywords = st.text_input("Enter related keywords (comma-separated):", placeholder="e.g. AI, healthcare, diagnosis")
query = ""
if task_choice == "Ask Chatbot":
query = st.text_area("Ask your question:", placeholder="e.g. How to format a research abstract?")
if st.button("π Run Agent"):
if not topic and task_choice != "Ask Chatbot":
st.warning("Please enter a topic for the selected task.")
elif task_choice == "Ask Chatbot" and not query:
st.warning("Please enter a chatbot query.")
else:
with st.spinner("Agent is working on your task..."):
# Format input text based on task type
input_text = (
query if task_choice == "Ask Chatbot"
else f"Topic: {topic}\nKeywords: {keywords}"
)
result = run_task(task_map[task_choice], input_text)
st.success("β
Task Completed!")
st.subheader("π Result")
st.markdown(result, unsafe_allow_html=True)
st.markdown(
"""
<hr>
<center>
<small>Built By Parthib</small>
</center>
""",
unsafe_allow_html=True
)
|