Spaces:
Running
on
T4
Running
on
T4
AngelinaZanardi
commited on
Commit
•
ebf43e3
1
Parent(s):
1c97cba
Update app.py
Browse files
app.py
CHANGED
@@ -18,6 +18,7 @@ import yt_dlp # Added import for yt-dlp
|
|
18 |
|
19 |
MODEL_NAME = "NbAiLab/nb-whisper-large"
|
20 |
lang = "no"
|
|
|
21 |
|
22 |
share = (os.environ.get("SHARE", "False")[0].lower() in "ty1") or None
|
23 |
auth_token = os.environ.get("AUTH_TOKEN") or True
|
@@ -29,7 +30,7 @@ def pipe(file, return_timestamps=False):
|
|
29 |
asr = pipeline(
|
30 |
task="automatic-speech-recognition",
|
31 |
model=MODEL_NAME,
|
32 |
-
chunk_length_s=
|
33 |
device=device,
|
34 |
token=auth_token,
|
35 |
torch_dtype=torch.float16,
|
@@ -97,6 +98,7 @@ def yt_transcribe(yt_url, return_timestamps=False):
|
|
97 |
demo = gr.Blocks()
|
98 |
|
99 |
with demo:
|
|
|
100 |
mf_transcribe = gr.Interface(
|
101 |
fn=transcribe,
|
102 |
inputs=[
|
@@ -110,6 +112,7 @@ with demo:
|
|
110 |
f" modellen [{MODEL_NAME}](https://huggingface.co/{MODEL_NAME}) og 🤗 Transformers til å transkribere lydfiler opp til 30 minutter."
|
111 |
),
|
112 |
allow_flagging="never",
|
|
|
113 |
)
|
114 |
|
115 |
# Uncomment to add the YouTube transcription interface if needed
|
|
|
18 |
|
19 |
MODEL_NAME = "NbAiLab/nb-whisper-large"
|
20 |
lang = "no"
|
21 |
+
logo_path = "/home/angelina/Nedlastinger/Screenshot 2024-10-10 at 13-30-13 Nasjonalbiblioteket — Melkeveien designkontor.png"
|
22 |
|
23 |
share = (os.environ.get("SHARE", "False")[0].lower() in "ty1") or None
|
24 |
auth_token = os.environ.get("AUTH_TOKEN") or True
|
|
|
30 |
asr = pipeline(
|
31 |
task="automatic-speech-recognition",
|
32 |
model=MODEL_NAME,
|
33 |
+
chunk_length_s=28,
|
34 |
device=device,
|
35 |
token=auth_token,
|
36 |
torch_dtype=torch.float16,
|
|
|
98 |
demo = gr.Blocks()
|
99 |
|
100 |
with demo:
|
101 |
+
gr.Image(value=logo_path, label="Nasjonalbibliotek Logo", elem_id="logo")
|
102 |
mf_transcribe = gr.Interface(
|
103 |
fn=transcribe,
|
104 |
inputs=[
|
|
|
112 |
f" modellen [{MODEL_NAME}](https://huggingface.co/{MODEL_NAME}) og 🤗 Transformers til å transkribere lydfiler opp til 30 minutter."
|
113 |
),
|
114 |
allow_flagging="never",
|
115 |
+
show_submit_button=False,
|
116 |
)
|
117 |
|
118 |
# Uncomment to add the YouTube transcription interface if needed
|