Spaces:
Runtime error
Runtime error
import streamlit as st | |
from ai_assistant import ai_doctor_chat | |
# Display title | |
st.markdown("<h1 style='text-align: center;'>Your AI Doctor Using Custom Knowledge Base 🤖</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="π¨") | |
st.write("Happy to Connect:") | |
kaggle, linkedin, google_scholar, youtube, github = st.columns(5) | |
# Define the URLs for the images you want to display | |
image_urls = { | |
"kaggle": "https://www.kaggle.com/static/images/site-logo.svg", | |
"linkedin": "https://media.licdn.com/dms/image/D4E10AQGEG4dnArk84Q/image-shrink_1280/0/1709719491267?e=1712952000&v=beta&t=n5TRDe586h-3EEPLlepsBoyvTcA2OJgw9VSuYNYRQ2U", | |
"google_scholar": "https://upload.wikimedia.org/wikipedia/commons/thumb/c/c7/Google_Scholar_logo.svg/768px-Google_Scholar_logo.svg.png", | |
"youtube": "https://upload.wikimedia.org/wikipedia/commons/thumb/7/72/YouTube_social_white_square_%282017%29.svg/640px-YouTube_social_white_square_%282017%29.svg.png", | |
"github": "https://github.githubassets.com/assets/GitHub-Mark-ea2971cee799.png" | |
} | |
social_links = { | |
"kaggle": "https://www.kaggle.com/muhammadimran112233", | |
"linkedin": "https://www.linkedin.com/in/muhammad-imran-zaman", | |
"google_scholar": "https://scholar.google.com/citations?user=ulVFpy8AAAAJ&hl=en", | |
"youtube": "https://www.youtube.com/@consolioo", | |
"github": "https://github.com/Imran-ml" | |
} | |
kaggle.markdown(f'<a href="{social_links["kaggle"]}"><img src="{image_urls["kaggle"]}" width="50" height="50"></a>', unsafe_allow_html=True) | |
linkedin.markdown(f'<a href="{social_links["linkedin"]}"><img src="{image_urls["linkedin"]}" width="50" height="50"></a>', unsafe_allow_html=True) | |
google_scholar.markdown(f'<a href="{social_links["google_scholar"]}"><img src="{image_urls["google_scholar"]}" width="50" height="50"></a>', unsafe_allow_html=True) | |
youtube.markdown(f'<a href="{social_links["youtube"]}"><img src="{image_urls["youtube"]}" width="50" height="50"></a>', unsafe_allow_html=True) | |
github.markdown(f'<a href="{social_links["github"]}"><img src="{image_urls["github"]}" width="50" height="50"></a>', unsafe_allow_html=True) | |
st.markdown("---") |