Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -425,12 +425,11 @@ def whisper_transcribe_audio(filename):
|
|
425 |
output = whisper(filename)
|
426 |
return output
|
427 |
|
428 |
-
def whisper_save_transcription(transcription):
|
429 |
-
file_path = 'text_output.txt'
|
430 |
with open(file_path, 'a') as f:
|
431 |
f.write(f"{transcription}\n")
|
432 |
|
433 |
-
def whisper_load_previous_transcriptions():
|
434 |
if os.path.exists(file_path):
|
435 |
with open(file_path, 'r') as f:
|
436 |
return f.read()
|
@@ -439,8 +438,9 @@ def whisper_load_previous_transcriptions():
|
|
439 |
def whisper_main():
|
440 |
st.title("AI Whisperer Speech to Text 🎤📝")
|
441 |
st.write("Record your speech and get the text. 🗨️")
|
442 |
-
|
443 |
-
|
|
|
444 |
text_area = st.text_area("Transcriptions:", previous_transcriptions, height=400)
|
445 |
|
446 |
filename = whisper_save_and_play_audio(audio_recorder)
|
@@ -449,7 +449,7 @@ def whisper_main():
|
|
449 |
transcription = whisper_transcribe_audio(filename)
|
450 |
updated_transcriptions = f"{previous_transcriptions}\n{transcription}"
|
451 |
st.text_area("Transcriptions:", updated_transcriptions, height=400)
|
452 |
-
whisper_save_transcription(transcription)
|
453 |
#except:
|
454 |
# st.write('Whisperer loading..')
|
455 |
|
|
|
425 |
output = whisper(filename)
|
426 |
return output
|
427 |
|
428 |
+
def whisper_save_transcription(transcription, file_path):
|
|
|
429 |
with open(file_path, 'a') as f:
|
430 |
f.write(f"{transcription}\n")
|
431 |
|
432 |
+
def whisper_load_previous_transcriptions(file_path):
|
433 |
if os.path.exists(file_path):
|
434 |
with open(file_path, 'r') as f:
|
435 |
return f.read()
|
|
|
438 |
def whisper_main():
|
439 |
st.title("AI Whisperer Speech to Text 🎤📝")
|
440 |
st.write("Record your speech and get the text. 🗨️")
|
441 |
+
|
442 |
+
file_path = 'text_output.txt'
|
443 |
+
previous_transcriptions = whisper_load_previous_transcriptions(file_path)
|
444 |
text_area = st.text_area("Transcriptions:", previous_transcriptions, height=400)
|
445 |
|
446 |
filename = whisper_save_and_play_audio(audio_recorder)
|
|
|
449 |
transcription = whisper_transcribe_audio(filename)
|
450 |
updated_transcriptions = f"{previous_transcriptions}\n{transcription}"
|
451 |
st.text_area("Transcriptions:", updated_transcriptions, height=400)
|
452 |
+
whisper_save_transcription(transcription, file_path)
|
453 |
#except:
|
454 |
# st.write('Whisperer loading..')
|
455 |
|