Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -72,13 +72,18 @@ def transcribe_audio(openai_key, file_path, model):
|
|
72 |
return None
|
73 |
|
74 |
def save_and_play_audio(audio_recorder):
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
|
|
|
|
|
|
|
|
|
|
82 |
return None
|
83 |
|
84 |
# Updated to call direct from transcription to chat inference.
|
|
|
72 |
return None
|
73 |
|
74 |
def save_and_play_audio(audio_recorder):
|
75 |
+
col1 = st.sidebar.columns([1]) # adjust the ratio as needed
|
76 |
+
with col1:
|
77 |
+
try:
|
78 |
+
audio_bytes = audio_recorder()
|
79 |
+
if audio_bytes:
|
80 |
+
filename = generate_filename("Recording", "wav")
|
81 |
+
with open(filename, 'wb') as f:
|
82 |
+
f.write(audio_bytes)
|
83 |
+
st.audio(audio_bytes, format="audio/wav")
|
84 |
+
return filename
|
85 |
+
except Exception as e:
|
86 |
+
st.error(f"Error occurred while processing audio recording")
|
87 |
return None
|
88 |
|
89 |
# Updated to call direct from transcription to chat inference.
|