Spaces:
Sleeping
Sleeping
Update app
Browse filesAdd PyTorch
app.py
CHANGED
@@ -1,14 +1,14 @@
|
|
1 |
from transformers import pipeline
|
2 |
-
|
3 |
import gradio as gr
|
4 |
|
5 |
-
|
6 |
|
7 |
pipe = pipeline(
|
8 |
"automatic-speech-recognition",
|
9 |
model="openai/whisper-small.en",
|
10 |
chunk_length_s=30,
|
11 |
-
|
12 |
)
|
13 |
|
14 |
# Function to transcribe audio
|
|
|
1 |
from transformers import pipeline
|
2 |
+
import torch
|
3 |
import gradio as gr
|
4 |
|
5 |
+
device = "cuda:0" if torch.cuda.is_available() else "cpu"
|
6 |
|
7 |
pipe = pipeline(
|
8 |
"automatic-speech-recognition",
|
9 |
model="openai/whisper-small.en",
|
10 |
chunk_length_s=30,
|
11 |
+
device=device,
|
12 |
)
|
13 |
|
14 |
# Function to transcribe audio
|