Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
ZennyKenny
commited on
add cuda
Browse files
app.py
CHANGED
@@ -5,11 +5,11 @@ from transformers import pipeline
|
|
5 |
@spaces.GPU(duration=60)
|
6 |
|
7 |
# Check if GPU is available; fallback to CPU if not
|
8 |
-
device = 0 if torch.cuda.is_available() else -1
|
9 |
|
10 |
try:
|
11 |
# Load models with error handling
|
12 |
-
transcriber = pipeline("automatic-speech-recognition", model="openai/whisper-base", device=
|
13 |
summarizer = pipeline("summarization", model="facebook/bart-large-cnn")
|
14 |
except Exception as e:
|
15 |
print(f"Error loading models: {e}")
|
|
|
5 |
@spaces.GPU(duration=60)
|
6 |
|
7 |
# Check if GPU is available; fallback to CPU if not
|
8 |
+
# device = 0 if torch.cuda.is_available() else -1
|
9 |
|
10 |
try:
|
11 |
# Load models with error handling
|
12 |
+
transcriber = pipeline("automatic-speech-recognition", model="openai/whisper-base", device=cuda)
|
13 |
summarizer = pipeline("summarization", model="facebook/bart-large-cnn")
|
14 |
except Exception as e:
|
15 |
print(f"Error loading models: {e}")
|