bano1 commited on
Commit
4c3e98e
·
verified ·
1 Parent(s): a7d5418

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -2
app.py CHANGED
@@ -156,14 +156,16 @@ if "user_input" not in st.session_state:
156
  st.session_state.user_input = ""
157
 
158
  # Set voice_text only if user_input is empty
159
- if voice_text:
160
  st.session_state.user_input = voice_text
161
 
162
 
163
  # Input box (editable by user after voice transcription too)
164
  user_input = st.text_area("💬 Type your message here OR use your voice above",value=st.session_state.user_input, height=100)
165
- st.session_state.user_input = user_input
166
 
 
 
 
167
  if st.button("Send") and user_input:
168
  st.session_state.chat_history.append(("You", user_input))
169
  if not api_key:
 
156
  st.session_state.user_input = ""
157
 
158
  # Set voice_text only if user_input is empty
159
+ if voice_text and not st.session_state.user_input.strip():
160
  st.session_state.user_input = voice_text
161
 
162
 
163
  # Input box (editable by user after voice transcription too)
164
  user_input = st.text_area("💬 Type your message here OR use your voice above",value=st.session_state.user_input, height=100)
 
165
 
166
+ if user_input != st.session_state.user_input:
167
+ st.session_state.user_input = user_input
168
+
169
  if st.button("Send") and user_input:
170
  st.session_state.chat_history.append(("You", user_input))
171
  if not api_key: