Spaces:
Runtime error
Runtime error
osanseviero
commited on
Commit
•
2ad002f
1
Parent(s):
b353f68
Update app.py (#4)
Browse files- Update app.py (e33d283da797895c07d398fa972efd701112db12)
app.py
CHANGED
@@ -3,7 +3,7 @@ import torch
|
|
3 |
import gradio as gr
|
4 |
import pytube as pt
|
5 |
from transformers import pipeline
|
6 |
-
|
7 |
|
8 |
MODEL_NAME = "openai/whisper-small"
|
9 |
|
@@ -16,6 +16,9 @@ pipe = pipeline(
|
|
16 |
device=device,
|
17 |
)
|
18 |
|
|
|
|
|
|
|
19 |
|
20 |
def transcribe(microphone, file_upload):
|
21 |
warn_output = ""
|
@@ -72,6 +75,7 @@ mf_transcribe = gr.Interface(
|
|
72 |
f" checkpoint [{MODEL_NAME}](https://huggingface.co/{MODEL_NAME}) and 🤗 Transformers to transcribe audio files"
|
73 |
" of arbitrary length."
|
74 |
),
|
|
|
75 |
allow_flagging="never",
|
76 |
)
|
77 |
|
@@ -87,6 +91,7 @@ yt_transcribe = gr.Interface(
|
|
87 |
f" [{MODEL_NAME}](https://huggingface.co/{MODEL_NAME}) and 🤗 Transformers to transcribe audio files of"
|
88 |
" arbitrary length."
|
89 |
),
|
|
|
90 |
allow_flagging="never",
|
91 |
)
|
92 |
|
|
|
3 |
import gradio as gr
|
4 |
import pytube as pt
|
5 |
from transformers import pipeline
|
6 |
+
from huggingface_hub import model_info
|
7 |
|
8 |
MODEL_NAME = "openai/whisper-small"
|
9 |
|
|
|
16 |
device=device,
|
17 |
)
|
18 |
|
19 |
+
langs = model_info(MODEL_NAME).cardData["language"]
|
20 |
+
|
21 |
+
article = f"<details><summary>This model supports {len(langs)} languages! (Click to expand)</summary>> {langs}</details>"
|
22 |
|
23 |
def transcribe(microphone, file_upload):
|
24 |
warn_output = ""
|
|
|
75 |
f" checkpoint [{MODEL_NAME}](https://huggingface.co/{MODEL_NAME}) and 🤗 Transformers to transcribe audio files"
|
76 |
" of arbitrary length."
|
77 |
),
|
78 |
+
article=article,
|
79 |
allow_flagging="never",
|
80 |
)
|
81 |
|
|
|
91 |
f" [{MODEL_NAME}](https://huggingface.co/{MODEL_NAME}) and 🤗 Transformers to transcribe audio files of"
|
92 |
" arbitrary length."
|
93 |
),
|
94 |
+
article=article,
|
95 |
allow_flagging="never",
|
96 |
)
|
97 |
|