Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,27 +1,27 @@
|
|
| 1 |
import os
|
| 2 |
-
os.system("pip install git+https://github.com/openai/whisper.git")
|
| 3 |
import gradio as gr
|
| 4 |
-
import whisper
|
| 5 |
|
| 6 |
-
from share_btn import community_icon_html, loading_icon_html, share_js
|
| 7 |
|
| 8 |
-
model = whisper.load_model("small")
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
def inference(audio):
|
| 13 |
-
audio = whisper.load_audio(audio)
|
| 14 |
-
audio = whisper.pad_or_trim(audio)
|
| 15 |
|
| 16 |
-
mel = whisper.log_mel_spectrogram(audio).to(model.device)
|
| 17 |
|
| 18 |
-
_, probs = model.detect_language(mel)
|
| 19 |
|
| 20 |
-
options = whisper.DecodingOptions(fp16 = False)
|
| 21 |
-
result = whisper.decode(model, mel, options)
|
| 22 |
|
| 23 |
-
print(result.text)
|
| 24 |
-
return
|
| 25 |
|
| 26 |
|
| 27 |
|
|
|
|
| 1 |
import os
|
| 2 |
+
# os.system("pip install git+https://github.com/openai/whisper.git")
|
| 3 |
import gradio as gr
|
| 4 |
+
# import whisper
|
| 5 |
|
| 6 |
+
# from share_btn import community_icon_html, loading_icon_html, share_js
|
| 7 |
|
| 8 |
+
# model = whisper.load_model("small")
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
def inference(audio):
|
| 13 |
+
# audio = whisper.load_audio(audio)
|
| 14 |
+
# audio = whisper.pad_or_trim(audio)
|
| 15 |
|
| 16 |
+
# mel = whisper.log_mel_spectrogram(audio).to(model.device)
|
| 17 |
|
| 18 |
+
# _, probs = model.detect_language(mel)
|
| 19 |
|
| 20 |
+
# options = whisper.DecodingOptions(fp16 = False)
|
| 21 |
+
# result = whisper.decode(model, mel, options)
|
| 22 |
|
| 23 |
+
# print(result.text)
|
| 24 |
+
return 'test', gr.update(visible=True), gr.update(visible=True), gr.update(visible=True)
|
| 25 |
|
| 26 |
|
| 27 |
|