Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -3,7 +3,6 @@ import os
|
|
| 3 |
|
| 4 |
HF_TOKEN = os.getenv('HW_Token')
|
| 5 |
hf_writer = gr.HuggingFaceDatasetSaver(HF_TOKEN, "save_audio")
|
| 6 |
-
|
| 7 |
import gradio as gr
|
| 8 |
import os
|
| 9 |
|
|
@@ -46,7 +45,7 @@ def save_audio_text(audio, text):
|
|
| 46 |
os.makedirs("/tmp/recordings")
|
| 47 |
|
| 48 |
# Debugging to print out the structure of the audio variable
|
| 49 |
-
print(audio)
|
| 50 |
|
| 51 |
# Check if audio is a dictionary and contains 'data'
|
| 52 |
if isinstance(audio, dict) and 'data' in audio:
|
|
@@ -82,7 +81,7 @@ with gr.Blocks() as demo:
|
|
| 82 |
generate_button.click(fn=update_output, inputs=file_upload, outputs=current_line)
|
| 83 |
|
| 84 |
with gr.Row():
|
| 85 |
-
audio_record =
|
| 86 |
save_button = gr.Button("Save Audio and Next Line")
|
| 87 |
|
| 88 |
save_button.click(fn=save_audio_text, inputs=[audio_record, current_line], outputs=current_line)
|
|
|
|
| 3 |
|
| 4 |
HF_TOKEN = os.getenv('HW_Token')
|
| 5 |
hf_writer = gr.HuggingFaceDatasetSaver(HF_TOKEN, "save_audio")
|
|
|
|
| 6 |
import gradio as gr
|
| 7 |
import os
|
| 8 |
|
|
|
|
| 45 |
os.makedirs("/tmp/recordings")
|
| 46 |
|
| 47 |
# Debugging to print out the structure of the audio variable
|
| 48 |
+
print("Received audio data:", audio)
|
| 49 |
|
| 50 |
# Check if audio is a dictionary and contains 'data'
|
| 51 |
if isinstance(audio, dict) and 'data' in audio:
|
|
|
|
| 81 |
generate_button.click(fn=update_output, inputs=file_upload, outputs=current_line)
|
| 82 |
|
| 83 |
with gr.Row():
|
| 84 |
+
audio_record = gr.Audio(sources=["microphone","upload"], type="filepath")
|
| 85 |
save_button = gr.Button("Save Audio and Next Line")
|
| 86 |
|
| 87 |
save_button.click(fn=save_audio_text, inputs=[audio_record, current_line], outputs=current_line)
|