Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,23 +1,27 @@
|
|
1 |
import streamlit as st
|
2 |
from ai_assistant import ai_doctor
|
3 |
|
4 |
-
|
|
|
5 |
|
6 |
-
# Display
|
7 |
-
|
|
|
|
|
|
|
8 |
|
9 |
# Create a text input box for the OpenAI key
|
10 |
-
openai_key =
|
11 |
|
12 |
-
query =
|
13 |
-
submit =
|
14 |
if submit:
|
15 |
if query and openai_key:
|
16 |
try:
|
17 |
-
with
|
18 |
response = mh_assistant(openai_key,query)
|
19 |
-
|
20 |
except Exception as e:
|
21 |
-
|
22 |
else:
|
23 |
-
|
|
|
1 |
import streamlit as st
|
2 |
from ai_assistant import ai_doctor
|
3 |
|
4 |
+
# Create layout with two columns
|
5 |
+
left_column, right_column = st.columns([1, 3])
|
6 |
|
7 |
+
# Display image in the left column
|
8 |
+
left_column.image("ai_doctor_img.jpg", caption="Your AI Doctor Image", width=200)
|
9 |
+
|
10 |
+
# Display title in the right column
|
11 |
+
right_column.markdown("<h1 style='text-align: center;'>Your AI Doctor 🤖</h1>", unsafe_allow_html=True)
|
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 right_column.spinner('Processing your query...'):
|
22 |
response = mh_assistant(openai_key,query)
|
23 |
+
right_column.write(response)
|
24 |
except Exception as e:
|
25 |
+
right_column.error(f'An error occurred: {e}',icon=':no_entry_sign:')
|
26 |
else:
|
27 |
+
right_column.error('Please enter your OpenAI key and Query both!',icon="🚨")
|