Spaces:
Build error
Build error
added gpu use
Browse files
app.py
CHANGED
|
@@ -1,15 +1,17 @@
|
|
| 1 |
from transformers import pipeline
|
| 2 |
import gradio as gr
|
|
|
|
| 3 |
|
| 4 |
transcribe = pipeline(
|
| 5 |
task="automatic-speech-recognition",
|
| 6 |
model="ckpt_base/checkpoint-1308",
|
| 7 |
tokenizer="ckpt_base",
|
| 8 |
chunk_length_s=30,
|
| 9 |
-
device=
|
| 10 |
)
|
| 11 |
|
| 12 |
transcribe.model.config.forced_decoder_ids = transcribe.tokenizer.get_decoder_prompt_ids(language="ja", task="transcribe")
|
|
|
|
| 13 |
def main(audio_path):
|
| 14 |
return transcribe(audio_path)["text"]
|
| 15 |
|
|
|
|
| 1 |
from transformers import pipeline
|
| 2 |
import gradio as gr
|
| 3 |
+
import spaces
|
| 4 |
|
| 5 |
transcribe = pipeline(
|
| 6 |
task="automatic-speech-recognition",
|
| 7 |
model="ckpt_base/checkpoint-1308",
|
| 8 |
tokenizer="ckpt_base",
|
| 9 |
chunk_length_s=30,
|
| 10 |
+
device='cuda',
|
| 11 |
)
|
| 12 |
|
| 13 |
transcribe.model.config.forced_decoder_ids = transcribe.tokenizer.get_decoder_prompt_ids(language="ja", task="transcribe")
|
| 14 |
+
@spaces.GPU
|
| 15 |
def main(audio_path):
|
| 16 |
return transcribe(audio_path)["text"]
|
| 17 |
|