Spaces:
Configuration error
Configuration error
# streamlit_app.py | |
import streamlit as st | |
import requests | |
# FastAPI server URL | |
api_url = "http://localhost:8000/chat/" | |
st.title("Conversational QA Chain") | |
# Streamlit input elements | |
question = st.text_input("Ask a question:") | |
if st.button("Submit"): | |
if question: | |
response = requests.get(api_url, params={"str1": question}) | |
if response.ok: | |
answer = response.json().get('message', 'No answer received') | |
st.write(f"Answer: {answer}") | |
else: | |
st.write("Error: Unable to get a response from the server") | |
# Example of providing some information about the app | |
st.markdown(""" | |
### Instructions | |
1. Enter your question in the text box. | |
2. Click on 'Submit' to get the answer. | |
""") | |