Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -6,14 +6,17 @@ model = whisper.load_model("small") # Change to "base", "medium", or "large" if
|
|
6 |
|
7 |
def transcribe(audio):
|
8 |
"""Transcribe Speech to Text"""
|
|
|
|
|
|
|
9 |
result = model.transcribe(audio)
|
10 |
return result["text"]
|
11 |
|
12 |
-
# Gradio UI
|
13 |
gr.Interface(
|
14 |
fn=transcribe,
|
15 |
-
inputs=gr.Audio(
|
16 |
outputs="text",
|
17 |
title="Whisper Speech-to-Text",
|
18 |
-
description="
|
19 |
).launch()
|
|
|
6 |
|
7 |
def transcribe(audio):
|
8 |
"""Transcribe Speech to Text"""
|
9 |
+
if audio is None:
|
10 |
+
return "No audio detected. Please try again."
|
11 |
+
|
12 |
result = model.transcribe(audio)
|
13 |
return result["text"]
|
14 |
|
15 |
+
# Corrected Gradio UI
|
16 |
gr.Interface(
|
17 |
fn=transcribe,
|
18 |
+
inputs=gr.Audio(sources=["microphone"], type="filepath"),
|
19 |
outputs="text",
|
20 |
title="Whisper Speech-to-Text",
|
21 |
+
description="Click 'Record', speak into the microphone, then stop recording to get text output.",
|
22 |
).launch()
|