File size: 765 Bytes
891be82
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
# 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.

""")