ankandrew commited on
Commit
b8e512a
·
verified ·
1 Parent(s): e2e8c97

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -2
app.py CHANGED
@@ -15,6 +15,10 @@ import whisper
15
 
16
  YT_AUDIO_FORMAT = "bestaudio[ext=m4a]"
17
 
 
 
 
 
18
 
19
  def download_youtube(url: str, tmp_dir: Path) -> Path:
20
  """Download the audio track from a YouTube video and return the local path."""
@@ -91,7 +95,7 @@ def transcribe_audio(
91
  "segments": segments,
92
  }
93
  )
94
- df_results = make_results_table(results, return_timestamps)
95
  return df_results
96
 
97
 
@@ -107,7 +111,7 @@ def build_demo() -> gr.Blocks:
107
  with gr.Row():
108
  model_choices = gr.Dropdown(
109
  label="Model size(s)",
110
- choices=["tiny", "base", "small", "medium", "large", "turbo"],
111
  value=["turbo"],
112
  multiselect=True,
113
  allow_custom_value=False,
 
15
 
16
  YT_AUDIO_FORMAT = "bestaudio[ext=m4a]"
17
 
18
+ MODEL_SIZES = ["tiny", "base", "small", "medium", "large", "turbo"]
19
+ for size in MODEL_SIZES:
20
+ whisper.load_model(size, device="cpu")
21
+
22
 
23
  def download_youtube(url: str, tmp_dir: Path) -> Path:
24
  """Download the audio track from a YouTube video and return the local path."""
 
95
  "segments": segments,
96
  }
97
  )
98
+ df_results = make_results_table(results)
99
  return df_results
100
 
101
 
 
111
  with gr.Row():
112
  model_choices = gr.Dropdown(
113
  label="Model size(s)",
114
+ choices=MODEL_SIZES,
115
  value=["turbo"],
116
  multiselect=True,
117
  allow_custom_value=False,