Your-AI-Doctor / app.py
ImranzamanML's picture
Update app.py
9cacea7 verified
raw
history blame
2.13 kB
import streamlit as st
# Assuming ai_doctor_chat is a custom function you've defined in ai_assistant.py
from ai_assistant import ai_doctor_chat
# Display title with centralized HTML styling
st.markdown("<h1 style='text-align: center;'>Your AI Doctor Using Your Custom Knowledge Base &#129302;</h1>", unsafe_allow_html=True)
# Create layout with two columns, adjusting the ratio for better visual distribution
left_column, right_column = st.columns([1, 3])
# Display an image in the left column. Assuming 'ai_doctor_img.jpg' is correctly located in your app's directory.
left_column.image("ai_doctor_img.jpg", width=200, use_column_width=True)
# Create a text input box for the OpenAI key, ensuring security by masking input
openai_key = right_column.text_input('Enter your OpenAI Key', type='password')
# Create a text input for user queries
query = right_column.text_input('Enter your query')
# Button to submit the query
submit = right_column.button('Submit')
if submit:
if query and openai_key:
try:
# Display a spinner while processing the query to improve user experience
with st.spinner('Processing your query...'):
response = ai_doctor_chat(openai_key, query)
right_column.success(response)
except Exception as e:
right_column.error(f'An error occurred: {e}')
else:
right_column.error('Please enter both your OpenAI key and your query!', icon="🚨")
# Separator for visual clarity
st.markdown("---")
st.write("Connect with me:")
# Create a row of columns for social media links
kaggle, linkedin, google_scholar, youtube, github = st.columns(5)
# Each column contains a hyperlink to a social profile, wrapped in markdown for formatting
kaggle.markdown("[Kaggle](https://www.kaggle.com/muhammadimran112233)")
linkedin.markdown("[LinkedIn](https://www.linkedin.com/in/muhammad-imran-zaman)")
google_scholar.markdown("[Google Scholar](https://scholar.google.com/citations?user=ulVFpy8AAAAJ&hl=en)")
youtube.markdown("[YouTube](https://www.youtube.com/@consolioo)")
github.markdown("[GitHub](https://github.com/Imran-ml)")