ImranzamanML commited on
Commit
f23e630
1 Parent(s): 9cacea7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +29 -19
app.py CHANGED
@@ -1,47 +1,57 @@
1
  import streamlit as st
2
-
3
- # Assuming ai_doctor_chat is a custom function you've defined in ai_assistant.py
4
  from ai_assistant import ai_doctor_chat
5
 
6
- # Display title with centralized HTML styling
7
  st.markdown("<h1 style='text-align: center;'>Your AI Doctor Using Your Custom Knowledge Base &#129302;</h1>", unsafe_allow_html=True)
8
 
9
- # Create layout with two columns, adjusting the ratio for better visual distribution
10
  left_column, right_column = st.columns([1, 3])
11
 
12
- # Display an image in the left column. Assuming 'ai_doctor_img.jpg' is correctly located in your app's directory.
13
- left_column.image("ai_doctor_img.jpg", width=200, use_column_width=True)
14
 
15
- # Create a text input box for the OpenAI key, ensuring security by masking input
16
  openai_key = right_column.text_input('Enter your OpenAI Key', type='password')
17
 
18
- # Create a text input for user queries
19
- query = right_column.text_input('Enter your query')
20
- # Button to submit the query
21
  submit = right_column.button('Submit')
22
-
23
  if submit:
24
  if query and openai_key:
25
  try:
26
- # Display a spinner while processing the query to improve user experience
27
  with st.spinner('Processing your query...'):
28
  response = ai_doctor_chat(openai_key, query)
29
- right_column.success(response)
30
  except Exception as e:
31
- right_column.error(f'An error occurred: {e}')
32
  else:
33
- right_column.error('Please enter both your OpenAI key and your query!', icon="🚨")
34
 
35
- # Separator for visual clarity
36
  st.markdown("---")
37
  st.write("Connect with me:")
38
-
39
- # Create a row of columns for social media links
 
 
 
 
 
 
 
 
40
  kaggle, linkedin, google_scholar, youtube, github = st.columns(5)
41
 
42
- # Each column contains a hyperlink to a social profile, wrapped in markdown for formatting
 
43
  kaggle.markdown("[Kaggle](https://www.kaggle.com/muhammadimran112233)")
 
 
44
  linkedin.markdown("[LinkedIn](https://www.linkedin.com/in/muhammad-imran-zaman)")
 
 
45
  google_scholar.markdown("[Google Scholar](https://scholar.google.com/citations?user=ulVFpy8AAAAJ&hl=en)")
 
 
46
  youtube.markdown("[YouTube](https://www.youtube.com/@consolioo)")
 
 
47
  github.markdown("[GitHub](https://github.com/Imran-ml)")
 
1
  import streamlit as st
 
 
2
  from ai_assistant import ai_doctor_chat
3
 
4
+ # Display title
5
  st.markdown("<h1 style='text-align: center;'>Your AI Doctor Using Your Custom Knowledge Base &#129302;</h1>", unsafe_allow_html=True)
6
 
7
+ # Create layout with two columns
8
  left_column, right_column = st.columns([1, 3])
9
 
10
+ # Display image in the left column
11
+ left_column.image("ai_doctor_img.jpg", width=200, use_column_width="auto")
12
 
13
+ # Create a text input box for the OpenAI key
14
  openai_key = right_column.text_input('Enter your OpenAI Key', type='password')
15
 
16
+ query = right_column.text_input('Enter your query', type='default')
 
 
17
  submit = right_column.button('Submit')
 
18
  if submit:
19
  if query and openai_key:
20
  try:
 
21
  with st.spinner('Processing your query...'):
22
  response = ai_doctor_chat(openai_key, query)
23
+ right_column.write(response)
24
  except Exception as e:
25
+ right_column.error(f'An error occurred: {e}', icon='🚨')
26
  else:
27
+ right_column.error('Please enter your OpenAI key and Query both!', icon="🚨")
28
 
 
29
  st.markdown("---")
30
  st.write("Connect with me:")
31
+ # Define the URLs for the images you want to display
32
+ image_urls = {
33
+ "kaggle": "https://www.kaggle.com/static/images/site-logo.svg",
34
+ "linkedin": "URL_TO_YOUR_LINKEDIN_IMAGE",
35
+ "google_scholar": "URL_TO_YOUR_GOOGLE_SCHOLAR_IMAGE",
36
+ "youtube": "URL_TO_YOUR_YOUTUBE_IMAGE",
37
+ "github": "URL_TO_YOUR_GITHUB_IMAGE"
38
+ }
39
+
40
+ # Create columns for each social profile link
41
  kaggle, linkedin, google_scholar, youtube, github = st.columns(5)
42
 
43
+ # For each column, display an image and a markdown link to a social profile
44
+ kaggle.image(image_urls["kaggle"], width=100)
45
  kaggle.markdown("[Kaggle](https://www.kaggle.com/muhammadimran112233)")
46
+
47
+ linkedin.image(image_urls["linkedin"], width=100)
48
  linkedin.markdown("[LinkedIn](https://www.linkedin.com/in/muhammad-imran-zaman)")
49
+
50
+ google_scholar.image(image_urls["google_scholar"], width=100)
51
  google_scholar.markdown("[Google Scholar](https://scholar.google.com/citations?user=ulVFpy8AAAAJ&hl=en)")
52
+
53
+ youtube.image(image_urls["youtube"], width=100)
54
  youtube.markdown("[YouTube](https://www.youtube.com/@consolioo)")
55
+
56
+ github.image(image_urls["github"], width=100)
57
  github.markdown("[GitHub](https://github.com/Imran-ml)")