File size: 713 Bytes
407b660
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# app.py
import streamlit as st
import requests

API_URL = " http://127.0.0.1:8000"  # Update this if deploying via Docker/Spaces

st.set_page_config(page_title="Research Assistant", layout="wide")
st.title("📚 LangChain-Powered Research Assistant")

query = st.text_input("Enter your research question")

if st.button("Ask"):
    if query.strip():
        with st.spinner("Searching documents..."):
            try:
                response = requests.post(API_URL, json={"query": query})
                result = response.json()
                st.success("Answer:")
                st.markdown(result["answer"])
            except Exception as e:
                st.error(f"Error: {e}")