Spaces:
Runtime error
Runtime error
Update app.py
Browse files
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 |
-
|
| 563 |
-
|
| 564 |
-
|
|
|
|
| 565 |
|
| 566 |
-
st.write(
|
| 567 |
-
response = StreamLLMChatResponse(
|
| 568 |
# st.write(response) - redundant with streaming result?
|
| 569 |
-
filename = generate_filename(
|
| 570 |
-
create_file(filename,
|
| 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
|