upgrade gradio and freeGPU spaces
Browse files- app.py +6 -8
- requirements.txt +2 -1
app.py
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
import torch
|
|
|
2 |
|
3 |
import gradio as gr
|
4 |
import pytube as pt
|
@@ -18,6 +19,7 @@ pipe = pipeline(
|
|
18 |
|
19 |
pipe.model.config.forced_decoder_ids = pipe.tokenizer.get_decoder_prompt_ids(language=lang, task="transcribe")
|
20 |
|
|
|
21 |
def transcribe(microphone, file_upload):
|
22 |
warn_output = ""
|
23 |
if (microphone is not None) and (file_upload is not None):
|
@@ -61,12 +63,10 @@ demo = gr.Blocks()
|
|
61 |
mf_transcribe = gr.Interface(
|
62 |
fn=transcribe,
|
63 |
inputs=[
|
64 |
-
gr.
|
65 |
-
gr.
|
66 |
],
|
67 |
outputs="text",
|
68 |
-
layout="horizontal",
|
69 |
-
theme="huggingface",
|
70 |
title="Whisper Demo: Transcribe Czech Audio",
|
71 |
description=(
|
72 |
"Transcribe long-form microphone or audio inputs with the click of a button! Demo uses the fine-tuned"
|
@@ -78,10 +78,8 @@ mf_transcribe = gr.Interface(
|
|
78 |
|
79 |
yt_transcribe = gr.Interface(
|
80 |
fn=yt_transcribe,
|
81 |
-
inputs=[gr.
|
82 |
outputs=["html", "text"],
|
83 |
-
layout="horizontal",
|
84 |
-
theme="huggingface",
|
85 |
title="Whisper Demo: Transcribe YouTube",
|
86 |
description=(
|
87 |
"Transcribe long-form YouTube videos with the click of a button! Demo uses the the fine-tuned checkpoint:"
|
@@ -94,4 +92,4 @@ yt_transcribe = gr.Interface(
|
|
94 |
with demo:
|
95 |
gr.TabbedInterface([mf_transcribe, yt_transcribe], ["Transcribe Audio", "Transcribe YouTube"])
|
96 |
|
97 |
-
demo.launch(
|
|
|
1 |
import torch
|
2 |
+
import spaces
|
3 |
|
4 |
import gradio as gr
|
5 |
import pytube as pt
|
|
|
19 |
|
20 |
pipe.model.config.forced_decoder_ids = pipe.tokenizer.get_decoder_prompt_ids(language=lang, task="transcribe")
|
21 |
|
22 |
+
@spaces.GPU
|
23 |
def transcribe(microphone, file_upload):
|
24 |
warn_output = ""
|
25 |
if (microphone is not None) and (file_upload is not None):
|
|
|
63 |
mf_transcribe = gr.Interface(
|
64 |
fn=transcribe,
|
65 |
inputs=[
|
66 |
+
gr.Audio(sources="microphone", type="filepath"),
|
67 |
+
gr.Audio(sources="upload", type="filepath"),
|
68 |
],
|
69 |
outputs="text",
|
|
|
|
|
70 |
title="Whisper Demo: Transcribe Czech Audio",
|
71 |
description=(
|
72 |
"Transcribe long-form microphone or audio inputs with the click of a button! Demo uses the fine-tuned"
|
|
|
78 |
|
79 |
yt_transcribe = gr.Interface(
|
80 |
fn=yt_transcribe,
|
81 |
+
inputs=[gr.Textbox(lines=1, placeholder="Paste the URL to a YouTube video here", label="YouTube URL")],
|
82 |
outputs=["html", "text"],
|
|
|
|
|
83 |
title="Whisper Demo: Transcribe YouTube",
|
84 |
description=(
|
85 |
"Transcribe long-form YouTube videos with the click of a button! Demo uses the the fine-tuned checkpoint:"
|
|
|
92 |
with demo:
|
93 |
gr.TabbedInterface([mf_transcribe, yt_transcribe], ["Transcribe Audio", "Transcribe YouTube"])
|
94 |
|
95 |
+
demo.launch(server_name="0.0.0.0")
|
requirements.txt
CHANGED
@@ -1,3 +1,4 @@
|
|
1 |
git+https://github.com/huggingface/transformers
|
2 |
torch
|
3 |
-
pytube
|
|
|
|
1 |
git+https://github.com/huggingface/transformers
|
2 |
torch
|
3 |
+
pytube
|
4 |
+
spaces
|