awacke1 commited on
Commit
99250d0
·
verified ·
1 Parent(s): 2099bf7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -3
app.py CHANGED
@@ -380,8 +380,8 @@ def main():
380
  st.rerun()
381
 
382
  # Voice Input Component
383
- mycomponent = components.html(open("speech.html").read(), height=400) # Assuming speech.html is in the same directory
384
- val = st.session_state.get('speech_input', '')
385
  if val and val != st.session_state.last_transcript:
386
  val_stripped = val.strip().replace('\n', ' ')
387
  if val_stripped:
@@ -390,7 +390,6 @@ def main():
390
  md_file, audio_file = asyncio.run(save_chat_entry(st.session_state.username, val_stripped, voice))
391
  if audio_file:
392
  play_and_download_audio(audio_file)
393
- st.session_state.speech_input = ''
394
  st.rerun()
395
 
396
  # Render Map
 
380
  st.rerun()
381
 
382
  # Voice Input Component
383
+ mycomponent = components.declare_component("speech_component", path="./speech_component")
384
+ val = mycomponent(my_input_value="", key=f"speech_{st.session_state.get('speech_processed', False)}")
385
  if val and val != st.session_state.last_transcript:
386
  val_stripped = val.strip().replace('\n', ' ')
387
  if val_stripped:
 
390
  md_file, audio_file = asyncio.run(save_chat_entry(st.session_state.username, val_stripped, voice))
391
  if audio_file:
392
  play_and_download_audio(audio_file)
 
393
  st.rerun()
394
 
395
  # Render Map