Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -54,10 +54,12 @@ def stream_transcribe(stream, new_chunk):
|
|
54 |
stream = np.concatenate([stream, y])
|
55 |
else:
|
56 |
stream = y
|
57 |
-
|
|
|
58 |
end_time = time.time()
|
59 |
latency = end_time - start_time
|
60 |
-
|
|
|
61 |
except Exception as e:
|
62 |
print(f"Error during Transcription: {e}")
|
63 |
return stream, e, "Error"
|
@@ -112,7 +114,7 @@ with gr.Blocks() as microphone:
|
|
112 |
with gr.Row():
|
113 |
clear_button = gr.Button("Clear Output")
|
114 |
state = gr.State()
|
115 |
-
input_audio_microphone.stream(stream_transcribe, [state, input_audio_microphone], [state, output, latency_textbox], time_limit=
|
116 |
clear_button.click(clear, outputs=[output])
|
117 |
|
118 |
with gr.Blocks() as file:
|
|
|
54 |
stream = np.concatenate([stream, y])
|
55 |
else:
|
56 |
stream = y
|
57 |
+
|
58 |
+
transcription = pipe({"sampling_rate": sr, "raw": stream})["text"]
|
59 |
end_time = time.time()
|
60 |
latency = end_time - start_time
|
61 |
+
|
62 |
+
return stream, transcription, f"{latency:.2f}"
|
63 |
except Exception as e:
|
64 |
print(f"Error during Transcription: {e}")
|
65 |
return stream, e, "Error"
|
|
|
114 |
with gr.Row():
|
115 |
clear_button = gr.Button("Clear Output")
|
116 |
state = gr.State()
|
117 |
+
input_audio_microphone.stream(stream_transcribe, [state, input_audio_microphone], [state, output, latency_textbox], time_limit=30, stream_every=1, concurrency_limit=None)
|
118 |
clear_button.click(clear, outputs=[output])
|
119 |
|
120 |
with gr.Blocks() as file:
|