Spaces:
Runtime error
Runtime error
first commit
Browse files- app.py +3 -0
- options/base_options.py +2 -1
- requirements.txt +2 -2
app.py
CHANGED
|
@@ -1,4 +1,7 @@
|
|
| 1 |
import torch
|
|
|
|
|
|
|
|
|
|
| 2 |
from torchvision import transforms
|
| 3 |
from PIL import Image
|
| 4 |
import gradio as gr
|
|
|
|
| 1 |
import torch
|
| 2 |
+
# Paksa penggunaan CPU jika tidak ada GPU
|
| 3 |
+
torch.cuda.is_available = lambda: False
|
| 4 |
+
|
| 5 |
from torchvision import transforms
|
| 6 |
from PIL import Image
|
| 7 |
import gradio as gr
|
options/base_options.py
CHANGED
|
@@ -158,7 +158,8 @@ class BaseOptions():
|
|
| 158 |
if id >= 0:
|
| 159 |
opt.gpu_ids.append(id)
|
| 160 |
if len(opt.gpu_ids) > 0:
|
| 161 |
-
|
|
|
|
| 162 |
|
| 163 |
self.opt = opt
|
| 164 |
return self.opt
|
|
|
|
| 158 |
if id >= 0:
|
| 159 |
opt.gpu_ids.append(id)
|
| 160 |
if len(opt.gpu_ids) > 0:
|
| 161 |
+
opt.gpu_ids = []
|
| 162 |
+
torch.device("cpu")
|
| 163 |
|
| 164 |
self.opt = opt
|
| 165 |
return self.opt
|
requirements.txt
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
-
torch
|
| 2 |
-
torchvision
|
| 3 |
gradio
|
| 4 |
pillow
|
| 5 |
huggingface_hub
|
|
|
|
| 1 |
+
torch==2.0.0+cpu
|
| 2 |
+
torchvision==0.15.1+cpu
|
| 3 |
gradio
|
| 4 |
pillow
|
| 5 |
huggingface_hub
|