Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -287,7 +287,8 @@ def realesrgan(img, model_name, denoise_strength, face_enhance, outscale):
|
|
| 287 |
# ----- CUDA / precision / tiling -----
|
| 288 |
use_cuda = False
|
| 289 |
try:
|
| 290 |
-
|
|
|
|
| 291 |
except Exception:
|
| 292 |
use_cuda = False
|
| 293 |
gpu_id = 0 if use_cuda else None
|
|
@@ -359,6 +360,7 @@ def render_progress(pct: float, text: str = "") -> str:
|
|
| 359 |
label = f"<div style='font-size:12px;opacity:.8;margin-top:4px;'>{text} {pct:.1f}%</div>"
|
| 360 |
return bar + label
|
| 361 |
|
|
|
|
| 362 |
def batch_realesrgan(
|
| 363 |
files: list, # from gr.Files (type='filepath')
|
| 364 |
model_name: str,
|
|
|
|
| 287 |
# ----- CUDA / precision / tiling -----
|
| 288 |
use_cuda = False
|
| 289 |
try:
|
| 290 |
+
import torch
|
| 291 |
+
use_cuda = torch.cuda.is_available()
|
| 292 |
except Exception:
|
| 293 |
use_cuda = False
|
| 294 |
gpu_id = 0 if use_cuda else None
|
|
|
|
| 360 |
label = f"<div style='font-size:12px;opacity:.8;margin-top:4px;'>{text} {pct:.1f}%</div>"
|
| 361 |
return bar + label
|
| 362 |
|
| 363 |
+
@GPU()
|
| 364 |
def batch_realesrgan(
|
| 365 |
files: list, # from gr.Files (type='filepath')
|
| 366 |
model_name: str,
|