Your-AI-Doctor / app.py
ImranzamanML's picture
Update app.py
b597a85 verified
raw
history blame
1.14 kB
import streamlit as st
from ai_assistant import ai_doctor
# Add image to left sidebar
st.markdown(
"""
<style>
.sidebar .sidebar-content {
width: 350px;
background-image: url('ai_doctor_img.jpg');
background-size: cover;
background-repeat: no-repeat;
background-position: center;
height: 100vh;
}
</style>
""",
unsafe_allow_html=True
)
# Display title in main content area
st.markdown("<h1 style='text-align: center;'>Your AI Doctor &#129302;</h1>", unsafe_allow_html=True)
# Create a text input box for the OpenAI key
openai_key = st.text_input('Enter your OpenAI Key', type='password')
query = st.text_input('Enter your query', type='default')
submit = st.button('Submit')
if submit:
if query and openai_key:
try:
with st.spinner('Processing your query...'):
response = mh_assistant(openai_key,query)
st.write(response)
except Exception as e:
st.error(f'An error occurred: {e}',icon=':no_entry_sign:')
else:
st.error('Please enter your OpenAI key and Query both!',icon="🚨")