Spaces:
Configuration error
Configuration error
File size: 1,086 Bytes
218ee66 d705216 218ee66 d705216 218ee66 d705216 218ee66 d705216 218ee66 |
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 |
# 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.')
|