mskov commited on
Commit
eb23c5b
·
1 Parent(s): 98a02af

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -5
app.py CHANGED
@@ -12,17 +12,21 @@ model_cache = {}
12
  def zero_shot_classify(audio_path: str, class_names: str, model_name: str) -> Dict[str, float]:
13
  class_names = class_names.split(",")
14
  print("model name: ", model_name)
15
- tokenizer = get_tokenizer(multilingual=".en" not in model_name)
16
- print("tokenizer ", tokenizer)
17
-
 
18
  if model_name not in model_cache:
19
- model = whisper.load_model(model_name)
20
  print("whisper model not in model_cache ", model)
21
  model_cache[model_name] = model
22
  else:
23
  model = model_cache[model_name]
24
  print("model is in cache ", model)
25
 
 
 
 
26
  internal_lm_average_logprobs = classify.calculate_internal_lm_average_logprobs(
27
  model=model,
28
  class_names=class_names,
@@ -73,7 +77,7 @@ def main():
73
  gr.Audio(label="Input Audio",show_label=False,source="microphone",type="filepath"),
74
  gr.Textbox(lines=1, label="Candidate class names (comma-separated)"),
75
  gr.Radio(
76
- choices=["tiny", "base", "small", "medium", "large"],
77
  value="small",
78
  label="Model Name",
79
  ),
 
12
  def zero_shot_classify(audio_path: str, class_names: str, model_name: str) -> Dict[str, float]:
13
  class_names = class_names.split(",")
14
  print("model name: ", model_name)
15
+
16
+ # Specify the path to the "whisper-small-esc50" model
17
+ model_path = "mskov/whisper-small-esc50"
18
+
19
  if model_name not in model_cache:
20
+ model = whisper.load_model(model_path)
21
  print("whisper model not in model_cache ", model)
22
  model_cache[model_name] = model
23
  else:
24
  model = model_cache[model_name]
25
  print("model is in cache ", model)
26
 
27
+ # Rest of your code remains the same
28
+ tokenizer = get_tokenizer(multilingual=".en" not in model_name)
29
+
30
  internal_lm_average_logprobs = classify.calculate_internal_lm_average_logprobs(
31
  model=model,
32
  class_names=class_names,
 
77
  gr.Audio(label="Input Audio",show_label=False,source="microphone",type="filepath"),
78
  gr.Textbox(lines=1, label="Candidate class names (comma-separated)"),
79
  gr.Radio(
80
+ choices=["whisper-small-esc50"],
81
  value="small",
82
  label="Model Name",
83
  ),