File size: 795 Bytes
bd93d27
e866dc3
bd93d27
e866dc3
 
c88d08b
 
 
07af824
c88d08b
8a774a8
63fc38f
 
9d22467
07af824
 
9d22467
 
 
8a774a8
3526c77
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import streamlit as st
from mental_health_raqa import mh_assistant


st.title('Mental Health Assistant :broken_heart:')

# Create a text input box for the OpenAI key
openai_key = st.text_input('Enter your OpenAI Key', type='password')
key_submit = st.button('Submit')
# Display the key when the user presses the 'Submit' button
if key_submit and openai_key:
    query = st.text_input('Enter your query', type='default')
    if query:
        try:
            with st.spinner('Processing your query...'):
                response = mh_assistant(openai_key,query)
            print("response",response)
        except Exception as e:
            st.error(f'An error occurred: {e}',icon=':no_entry_sign:')
elif key_submit and not openai_key:
    st.error('Please enter your OpenAI key',icon="🚨")