Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -45,7 +45,7 @@ def save_audio_text(audio, text):
|
|
45 |
if not os.path.exists("/tmp/recordings"):
|
46 |
os.makedirs("/tmp/recordings")
|
47 |
|
48 |
-
#
|
49 |
print("Received audio data:", audio)
|
50 |
|
51 |
try:
|
@@ -71,24 +71,9 @@ def save_audio_text(audio, text):
|
|
71 |
return "Error saving audio."
|
72 |
|
73 |
# Define the Gradio interface
|
74 |
-
with gr.
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
def update_output(file):
|
82 |
-
lines = reader.read_lines(file)
|
83 |
-
save_text_lines(file) # Save the text lines to a file
|
84 |
-
return lines
|
85 |
-
|
86 |
-
generate_button.click(fn=update_output, inputs=file_upload, outputs=current_line)
|
87 |
-
|
88 |
-
with gr.Row():
|
89 |
-
audio_record = gr.Audio(sources=["microphone","upload"], type="filepath")
|
90 |
-
save_button = gr.Button("Save Audio and Next Line")
|
91 |
-
|
92 |
-
save_button.click(fn=save_audio_text, inputs=[audio_record, current_line], outputs=current_line)
|
93 |
-
|
94 |
-
demo.launch()
|
|
|
45 |
if not os.path.exists("/tmp/recordings"):
|
46 |
os.makedirs("/tmp/recordings")
|
47 |
|
48 |
+
# Print out the structure of the audio variable for debugging
|
49 |
print("Received audio data:", audio)
|
50 |
|
51 |
try:
|
|
|
71 |
return "Error saving audio."
|
72 |
|
73 |
# Define the Gradio interface
|
74 |
+
with gr.Interface(
|
75 |
+
fn=save_audio_text,
|
76 |
+
inputs=[gr.Audio(source="microphone", type="file", label="Record Audio"), gr.Textbox(label="Current Line")],
|
77 |
+
outputs=gr.Textbox(label="Next Line")
|
78 |
+
) as iface:
|
79 |
+
iface.launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|