versae commited on
Commit
446a864
·
verified ·
1 Parent(s): ad19622

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -8,8 +8,8 @@ import spaces
8
  from transformers import pipeline
9
  from huggingface_hub import model_info
10
 
11
- MODEL_NAME = "NbAiLab/whisper-large-sme" #this always needs to stay in line 8 :D sorry for the hackiness
12
- lang = "fi"
13
 
14
  share = (os.environ.get("SHARE", "False")[0].lower() in "ty1") or None
15
  auth_token = os.environ.get("AUTH_TOKEN") or True
@@ -30,7 +30,7 @@ def pipe(file, return_timestamps=False):
30
  task="transcribe",
31
  no_timestamps=not return_timestamps,
32
  )
33
- # asr.model.config.no_timestamps_token_id = asr.tokenizer.encode("<|notimestamps|>", add_special_tokens=False)[0]
34
  return asr(file, return_timestamps=return_timestamps)
35
 
36
  def transcribe(file, return_timestamps=False):
@@ -74,7 +74,7 @@ mf_transcribe = gr.Interface(
74
  fn=transcribe,
75
  inputs=[
76
  gr.components.Audio(sources=['upload', 'microphone'], type="filepath"),
77
- # gr.components.Checkbox(label="Return timestamps"),
78
  ],
79
  outputs="text",
80
  theme="huggingface",
@@ -91,7 +91,7 @@ yt_transcribe = gr.Interface(
91
  fn=yt_transcribe,
92
  inputs=[
93
  gr.components.Textbox(lines=1, placeholder="Paste the URL to a YouTube video here", label="YouTube URL"),
94
- gr.components.Checkbox(label="Return timestamps"),
95
  ],
96
  examples=[["https://www.youtube.com/watch?v=mukeSSa5GKo"]],
97
  outputs=["html", "text"],
 
8
  from transformers import pipeline
9
  from huggingface_hub import model_info
10
 
11
+ MODEL_NAME = "NbAiLab/nb-whisper-large"
12
+ lang = "no"
13
 
14
  share = (os.environ.get("SHARE", "False")[0].lower() in "ty1") or None
15
  auth_token = os.environ.get("AUTH_TOKEN") or True
 
30
  task="transcribe",
31
  no_timestamps=not return_timestamps,
32
  )
33
+ asr.model.config.no_timestamps_token_id = asr.tokenizer.encode("<|notimestamps|>", add_special_tokens=False)[0]
34
  return asr(file, return_timestamps=return_timestamps)
35
 
36
  def transcribe(file, return_timestamps=False):
 
74
  fn=transcribe,
75
  inputs=[
76
  gr.components.Audio(sources=['upload', 'microphone'], type="filepath"),
77
+ gr.components.Checkbox(label="Return timestamps"),
78
  ],
79
  outputs="text",
80
  theme="huggingface",
 
91
  fn=yt_transcribe,
92
  inputs=[
93
  gr.components.Textbox(lines=1, placeholder="Paste the URL to a YouTube video here", label="YouTube URL"),
94
+ gr.components.Checkbox(label="Return timestamps"),
95
  ],
96
  examples=[["https://www.youtube.com/watch?v=mukeSSa5GKo"]],
97
  outputs=["html", "text"],