Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -46,22 +46,26 @@ def inference(img_path, model_name):
|
|
| 46 |
if model_name == "4xGRL":
|
| 47 |
weight_path = "pretrained/4x_APISR_GRL_GAN_generator.pth"
|
| 48 |
auto_download_if_needed(weight_path)
|
| 49 |
-
generator = load_grl(weight_path, scale=4
|
|
|
|
| 50 |
|
| 51 |
elif model_name == "4xRRDB":
|
| 52 |
weight_path = "pretrained/4x_APISR_RRDB_GAN_generator.pth"
|
| 53 |
auto_download_if_needed(weight_path)
|
| 54 |
-
generator = load_rrdb(weight_path, scale=4
|
|
|
|
| 55 |
|
| 56 |
elif model_name == "2xRRDB":
|
| 57 |
weight_path = "pretrained/2x_APISR_RRDB_GAN_generator.pth"
|
| 58 |
auto_download_if_needed(weight_path)
|
| 59 |
-
generator = load_rrdb(weight_path, scale=2
|
|
|
|
| 60 |
|
| 61 |
elif model_name == "4xDAT":
|
| 62 |
weight_path = "pretrained/4x_APISR_DAT_GAN_generator.pth"
|
| 63 |
auto_download_if_needed(weight_path)
|
| 64 |
-
generator = load_dat(weight_path, scale=4
|
|
|
|
| 65 |
|
| 66 |
else:
|
| 67 |
raise gr.Error("We don't support such Model")
|
|
|
|
| 46 |
if model_name == "4xGRL":
|
| 47 |
weight_path = "pretrained/4x_APISR_GRL_GAN_generator.pth"
|
| 48 |
auto_download_if_needed(weight_path)
|
| 49 |
+
generator = load_grl(weight_path, scale=4)
|
| 50 |
+
generator = generator.to(device='cpu')
|
| 51 |
|
| 52 |
elif model_name == "4xRRDB":
|
| 53 |
weight_path = "pretrained/4x_APISR_RRDB_GAN_generator.pth"
|
| 54 |
auto_download_if_needed(weight_path)
|
| 55 |
+
generator = load_rrdb(weight_path, scale=4)
|
| 56 |
+
generator = generator.to(device='cpu')
|
| 57 |
|
| 58 |
elif model_name == "2xRRDB":
|
| 59 |
weight_path = "pretrained/2x_APISR_RRDB_GAN_generator.pth"
|
| 60 |
auto_download_if_needed(weight_path)
|
| 61 |
+
generator = load_rrdb(weight_path, scale=2)
|
| 62 |
+
generator = generator.to(device='cpu')
|
| 63 |
|
| 64 |
elif model_name == "4xDAT":
|
| 65 |
weight_path = "pretrained/4x_APISR_DAT_GAN_generator.pth"
|
| 66 |
auto_download_if_needed(weight_path)
|
| 67 |
+
generator = load_dat(weight_path, scale=4)
|
| 68 |
+
generator = generator.to(device='cpu')
|
| 69 |
|
| 70 |
else:
|
| 71 |
raise gr.Error("We don't support such Model")
|