Update app.py
Browse files
app.py
CHANGED
|
@@ -1,4 +1,5 @@
|
|
| 1 |
import gradio as gr
|
|
|
|
| 2 |
from accelerate import init_empty_weights
|
| 3 |
import random
|
| 4 |
import json
|
|
@@ -19,7 +20,7 @@ genders = sorted(set(entry["gender"] for entry in data))
|
|
| 19 |
accents = sorted(set(entry["accent"] for entry in data))
|
| 20 |
|
| 21 |
# Load ASR pipelines
|
| 22 |
-
device = 0
|
| 23 |
pipe_whisper_tiny = pipeline("automatic-speech-recognition", model="openai/whisper-tiny", device=device)
|
| 24 |
pipe_whisper_tiny_en = pipeline("automatic-speech-recognition", model="openai/whisper-tiny.en", device=device)
|
| 25 |
pipe_whisper_base = pipeline("automatic-speech-recognition", model="openai/whisper-base", device=device)
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
+
import torch
|
| 3 |
from accelerate import init_empty_weights
|
| 4 |
import random
|
| 5 |
import json
|
|
|
|
| 20 |
accents = sorted(set(entry["accent"] for entry in data))
|
| 21 |
|
| 22 |
# Load ASR pipelines
|
| 23 |
+
device = 0 if torch.cuda.is_available() else -1
|
| 24 |
pipe_whisper_tiny = pipeline("automatic-speech-recognition", model="openai/whisper-tiny", device=device)
|
| 25 |
pipe_whisper_tiny_en = pipeline("automatic-speech-recognition", model="openai/whisper-tiny.en", device=device)
|
| 26 |
pipe_whisper_base = pipeline("automatic-speech-recognition", model="openai/whisper-base", device=device)
|