Spaces:
Runtime error
Runtime error
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
from ai_doctor import mh_assistant
|
| 3 |
+
|
| 4 |
+
st.title('Mental Health Assistant :broken_heart:')
|
| 5 |
+
|
| 6 |
+
# Create a text input box for the OpenAI key
|
| 7 |
+
openai_key = st.text_input('Enter your OpenAI Key', type='password')
|
| 8 |
+
|
| 9 |
+
query = st.text_input('Enter your query', type='default')
|
| 10 |
+
submit = st.button('Submit')
|
| 11 |
+
if submit:
|
| 12 |
+
if query and openai_key:
|
| 13 |
+
try:
|
| 14 |
+
with st.spinner('Processing your query...'):
|
| 15 |
+
response = mh_assistant(openai_key,query)
|
| 16 |
+
st.write(response)
|
| 17 |
+
except Exception as e:
|
| 18 |
+
st.error(f'An error occurred: {e}',icon=':no_entry_sign:')
|
| 19 |
+
else:
|
| 20 |
+
st.error('Please enter your OpenAI key and Query both!',icon="🚨")
|