Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -7,17 +7,14 @@ stt_pipeline = pipeline(
|
|
| 7 |
model="openai/whisper-small"
|
| 8 |
)
|
| 9 |
|
| 10 |
-
# Function: transcribe
|
| 11 |
def transcribe(audio):
|
| 12 |
if audio is None:
|
| 13 |
return "Please record some audio."
|
| 14 |
|
| 15 |
result = stt_pipeline(audio)
|
| 16 |
text = result["text"]
|
| 17 |
-
|
| 18 |
-
# lang = result.get("language", "unknown").capitalize()
|
| 19 |
-
|
| 20 |
-
# return f"Detected language: {lang}\n\n{text}"
|
| 21 |
|
| 22 |
with gr.Blocks() as demo:
|
| 23 |
gr.Markdown("# 🎙️ Speech to Text Converter")
|
|
@@ -35,3 +32,4 @@ with gr.Blocks() as demo:
|
|
| 35 |
demo.launch()
|
| 36 |
|
| 37 |
|
|
|
|
|
|
| 7 |
model="openai/whisper-small"
|
| 8 |
)
|
| 9 |
|
| 10 |
+
# Function: transcribe (auto-detects language internally)
|
| 11 |
def transcribe(audio):
|
| 12 |
if audio is None:
|
| 13 |
return "Please record some audio."
|
| 14 |
|
| 15 |
result = stt_pipeline(audio)
|
| 16 |
text = result["text"]
|
| 17 |
+
return text
|
|
|
|
|
|
|
|
|
|
| 18 |
|
| 19 |
with gr.Blocks() as demo:
|
| 20 |
gr.Markdown("# 🎙️ Speech to Text Converter")
|
|
|
|
| 32 |
demo.launch()
|
| 33 |
|
| 34 |
|
| 35 |
+
|