Spaces:
Running
on
T4
Running
on
T4
Update app.py
Browse files
app.py
CHANGED
@@ -19,8 +19,6 @@ import yt_dlp # Added import for yt-dlp
|
|
19 |
MODEL_NAME = "NbAiLab/nb-whisper-large"
|
20 |
lang = "no"
|
21 |
|
22 |
-
logo_path = "/home/angelina/Nedlastinger/Screenshot 2024-10-10 at 13-30-13 Nasjonalbiblioteket — Melkeveien designkontor.png"
|
23 |
-
|
24 |
share = (os.environ.get("SHARE", "False")[0].lower() in "ty1") or None
|
25 |
auth_token = os.environ.get("AUTH_TOKEN") or True
|
26 |
device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
|
@@ -64,7 +62,7 @@ def transcribe(file, return_timestamps=False):
|
|
64 |
line = f"[{start_time} -> {end_time}] {chunk['text']}"
|
65 |
text.append(line)
|
66 |
formatted_text = "\n".join(text)
|
67 |
-
formatted_text += "\n\
|
68 |
return formatted_text
|
69 |
|
70 |
def _return_yt_html_embed(yt_url):
|
@@ -100,7 +98,7 @@ def yt_transcribe(yt_url, return_timestamps=False):
|
|
100 |
demo = gr.Blocks()
|
101 |
|
102 |
with demo:
|
103 |
-
gr.
|
104 |
mf_transcribe = gr.Interface(
|
105 |
fn=transcribe,
|
106 |
inputs=[
|
@@ -136,4 +134,4 @@ with demo:
|
|
136 |
# )
|
137 |
|
138 |
# Start demoen uten faner
|
139 |
-
demo.launch(share=share).queue()
|
|
|
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
|
24 |
device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
|
|
|
62 |
line = f"[{start_time} -> {end_time}] {chunk['text']}"
|
63 |
text.append(line)
|
64 |
formatted_text = "\n".join(text)
|
65 |
+
formatted_text += "\n\n<i>Transkribert med NB-Whisper demo</i>"
|
66 |
return formatted_text
|
67 |
|
68 |
def _return_yt_html_embed(yt_url):
|
|
|
98 |
demo = gr.Blocks()
|
99 |
|
100 |
with demo:
|
101 |
+
gr.HTML('<center><img src="Logo.png" alt="Nasjonalbiblioteket Logo" width="300"></center>')
|
102 |
mf_transcribe = gr.Interface(
|
103 |
fn=transcribe,
|
104 |
inputs=[
|
|
|
134 |
# )
|
135 |
|
136 |
# Start demoen uten faner
|
137 |
+
demo.launch(share=share, show_api=False, show_tips=False).queue()
|