Spaces:
Runtime error
Runtime error
File size: 1,018 Bytes
a53de33 58c9522 a53de33 af7d62e 1e7717f 88cd75c 1e7717f af7d62e a53de33 1e7717f a53de33 1e7717f af7d62e a490061 1e7717f 378ade9 1e7717f |
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 |
import streamlit as st
from ai_assistant import ai_doctor_chat
# Display title
st.markdown("<h1 style='text-align: center;'>Your AI Doctor 🤖</h1>", unsafe_allow_html=True)
# Create layout with two columns
left_column, right_column = st.columns([1, 3])
# Display image in the left column
left_column.image("ai_doctor_img.jpg", width=200, use_column_width="auto")
# Create a text input box for the OpenAI key
openai_key = right_column.text_input('Enter your OpenAI Key', type='password')
query = right_column.text_input('Enter your query', type='default')
submit = right_column.button('Submit')
if submit:
if query and openai_key:
try:
with st.spinner('Processing your query...'):
response = ai_doctor_chat(openai_key, query)
right_column.write(response)
except Exception as e:
right_column.error(f'An error occurred: {e}', icon='🚨')
else:
right_column.error('Please enter your OpenAI key and Query both!', icon="🚨")
|