Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -5,8 +5,8 @@ import pytube as pt
|
|
5 |
from transformers import pipeline
|
6 |
from huggingface_hub import model_info
|
7 |
|
8 |
-
MODEL_NAME = "openai/whisper-
|
9 |
-
lang = "
|
10 |
|
11 |
device = 0 if torch.cuda.is_available() else "cpu"
|
12 |
pipe = pipeline(
|
@@ -61,37 +61,31 @@ demo = gr.Blocks()
|
|
61 |
mf_transcribe = gr.Interface(
|
62 |
fn=transcribe,
|
63 |
inputs=[
|
64 |
-
gr.
|
65 |
-
gr.
|
66 |
],
|
67 |
-
outputs="text"
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
" of arbitrary length."
|
75 |
-
),
|
76 |
-
allow_flagging="never",
|
77 |
)
|
78 |
|
79 |
yt_transcribe = gr.Interface(
|
80 |
fn=yt_transcribe,
|
81 |
-
inputs=[gr.
|
82 |
-
outputs=["html", "text"]
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
" arbitrary length."
|
90 |
-
),
|
91 |
-
allow_flagging="never",
|
92 |
)
|
93 |
|
94 |
with demo:
|
95 |
gr.TabbedInterface([mf_transcribe, yt_transcribe], ["Transcribe Audio", "Transcribe YouTube"])
|
96 |
|
97 |
-
demo.launch(enable_queue=True
|
|
|
5 |
from transformers import pipeline
|
6 |
from huggingface_hub import model_info
|
7 |
|
8 |
+
MODEL_NAME = "openai/whisper-large-v3" #this always needs to stay in line 8 :D sorry for the hackiness
|
9 |
+
lang = "ja"
|
10 |
|
11 |
device = 0 if torch.cuda.is_available() else "cpu"
|
12 |
pipe = pipeline(
|
|
|
61 |
mf_transcribe = gr.Interface(
|
62 |
fn=transcribe,
|
63 |
inputs=[
|
64 |
+
gr.Audio(type="filepath"),
|
65 |
+
gr.Audio(type="filepath"),
|
66 |
],
|
67 |
+
outputs="text"
|
68 |
+
)
|
69 |
+
mf_transcribe.title = "Whisper Demo: Transcribe Audio"
|
70 |
+
mf_transcribe.description = (
|
71 |
+
"Transcribe long-form microphone or audio inputs with the click of a button! Demo uses the the fine-tuned"
|
72 |
+
f" checkpoint [{MODEL_NAME}](https://huggingface.co/{MODEL_NAME}) and 🤗 Transformers to transcribe audio files"
|
73 |
+
" of arbitrary length."
|
|
|
|
|
|
|
74 |
)
|
75 |
|
76 |
yt_transcribe = gr.Interface(
|
77 |
fn=yt_transcribe,
|
78 |
+
inputs=[gr.Textbox(lines=1, placeholder="Paste the URL to a YouTube video here", label="YouTube URL")],
|
79 |
+
outputs=["html", "text"]
|
80 |
+
)
|
81 |
+
yt_transcribe.title = "Whisper Demo: Transcribe YouTube"
|
82 |
+
yt_transcribe.description = (
|
83 |
+
"Transcribe long-form YouTube videos with the click of a button! Demo uses the the fine-tuned checkpoint:"
|
84 |
+
f" [{MODEL_NAME}](https://huggingface.co/{MODEL_NAME}) and 🤗 Transformers to transcribe audio files of"
|
85 |
+
" arbitrary length."
|
|
|
|
|
|
|
86 |
)
|
87 |
|
88 |
with demo:
|
89 |
gr.TabbedInterface([mf_transcribe, yt_transcribe], ["Transcribe Audio", "Transcribe YouTube"])
|
90 |
|
91 |
+
demo.launch() #'enable_queue=True' を削除
|