awacke1 commited on
Commit
6cd3980
1 Parent(s): e3e8d08

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -9
app.py CHANGED
@@ -550,6 +550,7 @@ def transcribe_audio(filename):
550
  output = query(filename)
551
  return output
552
 
 
553
  def whisper_main():
554
  st.title("Speech to Text")
555
  st.write("Record your speech and get the text.")
@@ -558,19 +559,19 @@ def whisper_main():
558
  filename = save_and_play_audio(audio_recorder)
559
  if filename is not None:
560
  transcription = transcribe_audio(filename)
561
- try:
562
- transcription = transcription['text']
563
- except:
564
- st.write('Whisper model is asleep. Starting up now on T4 GPU - please give 5 minutes then retry as it scales up from zero to activate running container(s).')
 
565
 
566
- st.write(transcription)
567
- response = StreamLLMChatResponse(transcription)
568
  # st.write(response) - redundant with streaming result?
569
- filename = generate_filename(transcription, ".txt")
570
- create_file(filename, transcription, response, should_save)
571
  #st.sidebar.markdown(get_table_download_link(filename), unsafe_allow_html=True)
572
 
573
-
574
  import streamlit as st
575
 
576
  # Sample function to demonstrate a response, replace with your own logic
 
550
  output = query(filename)
551
  return output
552
 
553
+
554
  def whisper_main():
555
  st.title("Speech to Text")
556
  st.write("Record your speech and get the text.")
 
559
  filename = save_and_play_audio(audio_recorder)
560
  if filename is not None:
561
  transcription = transcribe_audio(filename)
562
+ #try:
563
+
564
+ transcript = transcription['text']
565
+ #except:
566
+ #st.write('Whisper model is asleep. Starting up now on T4 GPU - please give 5 minutes then retry as it scales up from zero to activate running container(s).')
567
 
568
+ st.write(transcript)
569
+ response = StreamLLMChatResponse(transcript)
570
  # st.write(response) - redundant with streaming result?
571
+ filename = generate_filename(transcript, ".txt")
572
+ create_file(filename, transcript, response, should_save)
573
  #st.sidebar.markdown(get_table_download_link(filename), unsafe_allow_html=True)
574
 
 
575
  import streamlit as st
576
 
577
  # Sample function to demonstrate a response, replace with your own logic