Spaces:
Running
on
T4
Running
on
T4
Update app.py
Browse files
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
|
12 |
-
lang = "
|
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 |
-
|
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 |
-
|
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 |
-
|
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"],
|