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. | |
""") | |
# import streamlit as st | |
# from main import qa | |
# st.title('Chatbot') | |
# user_input = st.text_input("Enter your question here:") | |
# if st.button('Submit'): | |
# if user_input: | |
# response = qa({"question": user_input}) | |
# st.write('Chatbot:', response.get('answer', '')) | |
# else: | |
# st.write('Please enter a question.') | |