import streamlit as st import requests st.set_page_config(page_title="BioRAG Assistant 🧬", page_icon="🧪", layout="wide") st.markdown("

🧠 BioRAG: Biology Learning Assistant

", unsafe_allow_html=True) st.markdown("

Ask your biology questions and get accurate, syllabus-based answers.

", unsafe_allow_html=True) with st.form("chat_form", clear_on_submit=True): question = st.text_input("Ask your question:", placeholder="e.g. What is the function of mitochondria?") submitted = st.form_submit_button("Ask") API_URL = "http://backend:2000/predict" if submitted and question: with st.spinner("Thinking..."): try: response = requests.post(API_URL, json={"question": question}) answer = response.json().get("answer", "Sorry, no answer found.") except Exception as e: answer = f"⚠️ Error: {e}" st.markdown(f"**🧑 You:** {question}") st.markdown( f"
🧬 BioRAG:
{answer}
", unsafe_allow_html=True )