-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstreamlit.py
More file actions
25 lines (21 loc) · 969 Bytes
/
Copy pathstreamlit.py
File metadata and controls
25 lines (21 loc) · 969 Bytes
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
import streamlit as st
import requests
API_URL = "http://127.0.0.1:8003/execute"
st.title("🩺 Doctor Appointment System")
user_id = st.text_input("Enter your ID number:", "")
query = st.text_area("Enter your query:", "Can you check if a dentist is available tomorrow at 10 AM?")
if st.button("Submit Query"):
if user_id and query:
try:
response = requests.post(API_URL, json={'messages': query, 'id_number': int(user_id)},verify=False)
if response.status_code == 200:
st.success("Response Received:")
print("**********my response******************")
print(response.json())
st.write(response.json()["messages"])
else:
st.error(f"Error {response.status_code}: Could not process the request.")
except Exception as e:
st.error(f"Exception occurred: {e}")
else:
st.warning("Please enter both ID and query.")