Commit
·
b91f9cc
1
Parent(s):
8bb4759
small fixes
Browse files
app.py
CHANGED
@@ -23,18 +23,14 @@ import logging
|
|
23 |
import os
|
24 |
import tempfile
|
25 |
import time
|
|
|
26 |
from datetime import datetime
|
27 |
|
28 |
import gradio as gr
|
29 |
import soundfile as sf
|
30 |
-
import urllib.request
|
31 |
|
32 |
-
|
33 |
-
from examples import examples
|
34 |
from model import decode, get_pretrained_model, whisper_models
|
35 |
|
36 |
-
languages = list(language_to_models.keys())
|
37 |
-
|
38 |
|
39 |
def convert_to_wav(in_filename: str) -> str:
|
40 |
"""Convert the input audio file to a wave file"""
|
@@ -143,7 +139,7 @@ def process(
|
|
143 |
date_time = now.strftime("%Y-%m-%d %H:%M:%S.%f")
|
144 |
end = time.time()
|
145 |
|
146 |
-
info =
|
147 |
duration = info.duration
|
148 |
|
149 |
elapsed = end - start
|
@@ -193,20 +189,11 @@ css = """
|
|
193 |
"""
|
194 |
|
195 |
|
196 |
-
def update_model_dropdown(language: str):
|
197 |
-
if language in language_to_models:
|
198 |
-
choices = language_to_models[language]
|
199 |
-
return gr.Dropdown.update(choices=choices, value=choices[0])
|
200 |
-
|
201 |
-
raise ValueError(f"Unsupported language: {language}")
|
202 |
-
|
203 |
-
|
204 |
demo = gr.Blocks(css=css)
|
205 |
|
206 |
|
207 |
with demo:
|
208 |
gr.Markdown(title)
|
209 |
-
language_choices = list(language_to_models.keys())
|
210 |
model_choices = list(whisper_models.keys())
|
211 |
|
212 |
model_dropdown = gr.Dropdown(
|
|
|
23 |
import os
|
24 |
import tempfile
|
25 |
import time
|
26 |
+
import urllib.request
|
27 |
from datetime import datetime
|
28 |
|
29 |
import gradio as gr
|
30 |
import soundfile as sf
|
|
|
31 |
|
|
|
|
|
32 |
from model import decode, get_pretrained_model, whisper_models
|
33 |
|
|
|
|
|
34 |
|
35 |
def convert_to_wav(in_filename: str) -> str:
|
36 |
"""Convert the input audio file to a wave file"""
|
|
|
139 |
date_time = now.strftime("%Y-%m-%d %H:%M:%S.%f")
|
140 |
end = time.time()
|
141 |
|
142 |
+
info = sf.info(filename)
|
143 |
duration = info.duration
|
144 |
|
145 |
elapsed = end - start
|
|
|
189 |
"""
|
190 |
|
191 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
192 |
demo = gr.Blocks(css=css)
|
193 |
|
194 |
|
195 |
with demo:
|
196 |
gr.Markdown(title)
|
|
|
197 |
model_choices = list(whisper_models.keys())
|
198 |
|
199 |
model_dropdown = gr.Dropdown(
|