-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathstreamlit_ui.py
More file actions
29 lines (25 loc) · 1.05 KB
/
streamlit_ui.py
File metadata and controls
29 lines (25 loc) · 1.05 KB
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
import streamlit as st
import requests
# Run server from steps.txt to enable API
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.")