Update app.py
Browse files
app.py
CHANGED
@@ -4,10 +4,11 @@ import whisper
|
|
4 |
# duplicate this space to run on higher CPU power for the large (very precise and multi-lingual) model to work best
|
5 |
|
6 |
def speech_to_text(uploaded, model_size):
|
|
|
|
|
7 |
model = whisper.load_model(model_size)
|
8 |
-
|
9 |
-
result
|
10 |
-
return f'{result["text"]}'
|
11 |
|
12 |
gr.Interface(
|
13 |
title="",
|
|
|
4 |
# duplicate this space to run on higher CPU power for the large (very precise and multi-lingual) model to work best
|
5 |
|
6 |
def speech_to_text(uploaded, model_size):
|
7 |
+
if not uploaded or not isinstance(uploaded, str):
|
8 |
+
return "No audio file uploaded."
|
9 |
model = whisper.load_model(model_size)
|
10 |
+
result = model.transcribe(uploaded)
|
11 |
+
return result["text"]
|
|
|
12 |
|
13 |
gr.Interface(
|
14 |
title="",
|