Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -760,9 +760,13 @@ def whisper_main():
|
|
| 760 |
filename = save_and_play_audio(audio_recorder)
|
| 761 |
if filename is not None:
|
| 762 |
transcription = transcribe_audio(filename)
|
| 763 |
-
|
| 764 |
-
|
| 765 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 766 |
|
| 767 |
|
| 768 |
# Whisper to GPT: New!! ---------------------------------------------------------------------
|
|
@@ -778,11 +782,14 @@ def whisper_main():
|
|
| 778 |
|
| 779 |
# Whisper to Llama:
|
| 780 |
response = StreamLLMChatResponse(transcript)
|
| 781 |
-
filename_txt = generate_filename(transcript, "
|
| 782 |
create_file(filename_txt, transcript, response, should_save)
|
| 783 |
filename_wav = filename_txt.replace('.txt', '.wav')
|
| 784 |
import shutil
|
| 785 |
-
|
|
|
|
|
|
|
|
|
|
| 786 |
if os.path.exists(filename):
|
| 787 |
os.remove(filename)
|
| 788 |
|
|
@@ -995,7 +1002,7 @@ def main():
|
|
| 995 |
try:
|
| 996 |
st.write('🔍Running with Llama.')
|
| 997 |
response = StreamLLMChatResponse(file_contents)
|
| 998 |
-
filename = generate_filename(user_prompt, "
|
| 999 |
create_file(filename, file_contents, response, should_save)
|
| 1000 |
all=response
|
| 1001 |
#SpeechSynthesis(response)
|
|
|
|
| 760 |
filename = save_and_play_audio(audio_recorder)
|
| 761 |
if filename is not None:
|
| 762 |
transcription = transcribe_audio(filename)
|
| 763 |
+
try:
|
| 764 |
+
transcript = transcription['text']
|
| 765 |
+
st.write(transcript)
|
| 766 |
+
|
| 767 |
+
except:
|
| 768 |
+
transcript=''
|
| 769 |
+
st.write(transcript)
|
| 770 |
|
| 771 |
|
| 772 |
# Whisper to GPT: New!! ---------------------------------------------------------------------
|
|
|
|
| 782 |
|
| 783 |
# Whisper to Llama:
|
| 784 |
response = StreamLLMChatResponse(transcript)
|
| 785 |
+
filename_txt = generate_filename(transcript, "md")
|
| 786 |
create_file(filename_txt, transcript, response, should_save)
|
| 787 |
filename_wav = filename_txt.replace('.txt', '.wav')
|
| 788 |
import shutil
|
| 789 |
+
try:
|
| 790 |
+
shutil.copyfile(filename, filename_wav)
|
| 791 |
+
except:
|
| 792 |
+
st.write('fail')
|
| 793 |
if os.path.exists(filename):
|
| 794 |
os.remove(filename)
|
| 795 |
|
|
|
|
| 1002 |
try:
|
| 1003 |
st.write('🔍Running with Llama.')
|
| 1004 |
response = StreamLLMChatResponse(file_contents)
|
| 1005 |
+
filename = generate_filename(user_prompt, "md")
|
| 1006 |
create_file(filename, file_contents, response, should_save)
|
| 1007 |
all=response
|
| 1008 |
#SpeechSynthesis(response)
|