Momal commited on
Commit
acf6933
·
1 Parent(s): 7d9a1fe

wrote response to foreground

Browse files
Files changed (1) hide show
  1. app.py +15 -16
app.py CHANGED
@@ -1,5 +1,5 @@
1
  import streamlit as st
2
- # from mental_health_raqa import mh_assistant
3
 
4
  #---------------------------------#
5
  import pandas as pd
@@ -63,18 +63,17 @@ def mh_assistant(openai_key,query):
63
  st.title('Mental Health Assistant :broken_heart:')
64
 
65
  # Create a text input box for the OpenAI key
66
- # openai_key = st.text_input('Enter your OpenAI Key', type='password')
67
- # key_submit = st.button('Submit')
68
- # # Display the key when the user presses the 'Submit' button
69
- # if key_submit and openai_key:
70
- query = st.text_input('Enter your query', type='default')
71
- if query:
72
- try:
73
- # with st.spinner('Processing your query...'):
74
- response = mh_assistant("jbkuyb",query)
75
- print("response",response)
76
- st.write(response)
77
- except Exception as e:
78
- st.error(f'An error occurred: {e}',icon=':no_entry_sign:')
79
- # elif key_submit and not openai_key:
80
- # st.error('Please enter your OpenAI key',icon="🚨")
 
1
  import streamlit as st
2
+ from mental_health_raqa import mh_assistant
3
 
4
  #---------------------------------#
5
  import pandas as pd
 
63
  st.title('Mental Health Assistant :broken_heart:')
64
 
65
  # Create a text input box for the OpenAI key
66
+ openai_key = st.text_input('Enter your OpenAI Key', type='password')
67
+ key_submit = st.button('Submit')
68
+ # Display the key when the user presses the 'Submit' button
69
+ if key_submit and openai_key:
70
+ query = st.text_input('Enter your query', type='default')
71
+ if query:
72
+ try:
73
+ with st.spinner('Processing your query...'):
74
+ response = mh_assistant(openai_key,query)
75
+ st.write(response)
76
+ except Exception as e:
77
+ st.error(f'An error occurred: {e}',icon=':no_entry_sign:')
78
+ elif key_submit and not openai_key:
79
+ st.error('Please enter your OpenAI key',icon="🚨")