Naz786 commited on
Commit
bbd9ea6
·
verified ·
1 Parent(s): 85a827a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -203,7 +203,7 @@ elif page == "Semantic Search":
203
  </script>
204
  ''', height=60)
205
 
206
- # If voice input is received, update the question field directly
207
  if voice_input and isinstance(voice_input, str) and voice_input.strip():
208
  if is_coding_question(voice_input):
209
  st.session_state["sem_question"] = voice_input
@@ -211,8 +211,8 @@ elif page == "Semantic Search":
211
  else:
212
  st.warning("Please ask a relevant question.")
213
 
214
- # Single input field for question (typed or spoken)
215
- question = st.text_input("Ask a question about your code", value=st.session_state["sem_question"], key="sem_question")
216
 
217
  # Run Semantic Search button
218
  if st.button("Run Semantic Search"):
 
203
  </script>
204
  ''', height=60)
205
 
206
+ # If voice input is received, update the question field directly in session state
207
  if voice_input and isinstance(voice_input, str) and voice_input.strip():
208
  if is_coding_question(voice_input):
209
  st.session_state["sem_question"] = voice_input
 
211
  else:
212
  st.warning("Please ask a relevant question.")
213
 
214
+ # This field is always in sync with session state, whether typed or spoken
215
+ question = st.text_input("Ask a question about your code", key="sem_question")
216
 
217
  # Run Semantic Search button
218
  if st.button("Run Semantic Search"):