Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
ZennyKenny
commited on
reduce gpu request
Browse files
app.py
CHANGED
@@ -3,7 +3,7 @@ import torch
|
|
3 |
from transformers import pipeline
|
4 |
import spaces # Ensure spaces library is imported if using GPU decorator
|
5 |
|
6 |
-
@spaces.GPU(duration=
|
7 |
def main():
|
8 |
# Force GPU if available, fallback to CPU
|
9 |
device = 0 if torch.cuda.is_available() else -1
|
|
|
3 |
from transformers import pipeline
|
4 |
import spaces # Ensure spaces library is imported if using GPU decorator
|
5 |
|
6 |
+
@spaces.GPU(duration=3) # Decorator to allocate GPU for the app
|
7 |
def main():
|
8 |
# Force GPU if available, fallback to CPU
|
9 |
device = 0 if torch.cuda.is_available() else -1
|