Update app.py
Browse files
app.py
CHANGED
@@ -1,15 +1,15 @@
|
|
1 |
import torch
|
2 |
from transformers import pipeline
|
3 |
|
4 |
-
device = "cuda:0" if torch.cuda.is_available() else "cpu"
|
5 |
pipe = pipeline(
|
6 |
"automatic-speech-recognition", model="openai/whisper-base", device=device
|
7 |
)
|
8 |
|
9 |
-
from datasets import load_dataset
|
10 |
|
11 |
-
dataset = load_dataset("facebook/voxpopuli", "en", split="validation", streaming=True, trust_remote_code=True)
|
12 |
-
sample = next(iter(dataset))
|
13 |
|
14 |
def translate(audio):
|
15 |
outputs = pipe(audio, max_new_tokens=256, generate_kwargs={"task": "transcribe", "language": "fr"}) # "language": "fr"
|
|
|
1 |
import torch
|
2 |
from transformers import pipeline
|
3 |
|
4 |
+
# device = "cuda:0" if torch.cuda.is_available() else "cpu"
|
5 |
pipe = pipeline(
|
6 |
"automatic-speech-recognition", model="openai/whisper-base", device=device
|
7 |
)
|
8 |
|
9 |
+
# from datasets import load_dataset
|
10 |
|
11 |
+
# dataset = load_dataset("facebook/voxpopuli", "en", split="validation", streaming=True, trust_remote_code=True)
|
12 |
+
# sample = next(iter(dataset))
|
13 |
|
14 |
def translate(audio):
|
15 |
outputs = pipe(audio, max_new_tokens=256, generate_kwargs={"task": "transcribe", "language": "fr"}) # "language": "fr"
|