Spaces:
Runtime error
Runtime error
| 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="🚨") |