UMESH266 commited on
Commit
eefaee7
1 Parent(s): 85afa8a

App updated

Browse files
Files changed (3) hide show
  1. app.py +21 -18
  2. requirements.txt +0 -1
  3. requirements_dev.txt +0 -1
app.py CHANGED
@@ -98,27 +98,30 @@ if mode == "Text" and st.session_state.HF_TOKEN == '':
98
  bot.write(f"Bot: {ans}")
99
 
100
  elif mode == "Voice" and st.session_state.HF_TOKEN == '':
101
- if 'chathist' not in st.session_state:
102
- st.session_state.chathist = dict()
103
-
104
- if st.button("speak"):
105
- user_input = record_voice()
 
106
 
107
- if user_input != "":
108
 
109
- # Exiting the chat
110
- if 'exit' in user_input:
111
- st.write(salutation)
112
- else:
113
- # Getting response and sentiment of response
114
- ans, senti = response(user_input)
115
 
116
- st.write(f"You: {user_input}")
117
- st.write(f"Bot: {ans}")
118
- play_speech(ans)
119
-
120
- # Chat history
121
- st.session_state.chathist = chat_history(user_input, ans, senti)
 
 
122
 
123
  # Chat history display
124
  if st.button("View Chat history"):
 
98
  bot.write(f"Bot: {ans}")
99
 
100
  elif mode == "Voice" and st.session_state.HF_TOKEN == '':
101
+ try:
102
+ if 'chathist' not in st.session_state:
103
+ st.session_state.chathist = dict()
104
+
105
+ if st.button("speak"):
106
+ user_input = record_voice()
107
 
108
+ if user_input != "":
109
 
110
+ # Exiting the chat
111
+ if 'exit' in user_input:
112
+ st.write(salutation)
113
+ else:
114
+ # Getting response and sentiment of response
115
+ ans, senti = response(user_input)
116
 
117
+ st.write(f"You: {user_input}")
118
+ st.write(f"Bot: {ans}")
119
+ play_speech(ans)
120
+
121
+ # Chat history
122
+ st.session_state.chathist = chat_history(user_input, ans, senti)
123
+ except Exception as e:
124
+ raise customexception(e, sys)
125
 
126
  # Chat history display
127
  if st.button("View Chat history"):
requirements.txt CHANGED
@@ -46,7 +46,6 @@ pandas==2.2.3
46
  pillow==10.4.0
47
  protobuf==5.28.3
48
  pyarrow==17.0.0
49
- PyAudio==0.2.14
50
  pydantic==2.9.2
51
  pydantic_core==2.23.4
52
  pydeck==0.9.1
 
46
  pillow==10.4.0
47
  protobuf==5.28.3
48
  pyarrow==17.0.0
 
49
  pydantic==2.9.2
50
  pydantic_core==2.23.4
51
  pydeck==0.9.1
requirements_dev.txt DELETED
@@ -1 +0,0 @@
1
- portaudio19-dev