Spaces:
Sleeping
Sleeping
Commit ·
2dda8cb
1
Parent(s): c0ec995
Add example images to the UI
Browse files- .gitattributes +4 -0
- app.py +13 -0
- examples/rain200h_1.png +3 -0
- examples/rain200h_2.png +3 -0
- examples/rain200h_3.png +3 -0
.gitattributes
CHANGED
|
@@ -1 +1,5 @@
|
|
| 1 |
*.pth filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
*.pth filter=lfs diff=lfs merge=lfs -text
|
| 2 |
+
*.webp filter=lfs diff=lfs merge=lfs -text
|
| 3 |
+
*.png filter=lfs diff=lfs merge=lfs -text
|
| 4 |
+
*.jpg filter=lfs diff=lfs merge=lfs -text
|
| 5 |
+
*.jpeg filter=lfs diff=lfs merge=lfs -text
|
app.py
CHANGED
|
@@ -4,6 +4,7 @@ import numpy as np
|
|
| 4 |
import torch
|
| 5 |
import torch.nn.functional as F
|
| 6 |
from skimage import img_as_ubyte
|
|
|
|
| 7 |
|
| 8 |
from models import find_models_def
|
| 9 |
|
|
@@ -19,6 +20,17 @@ except Exception: # pragma: no cover
|
|
| 19 |
MODEL = None
|
| 20 |
DEVICE = "cuda" if torch.cuda.is_available() else "cpu"
|
| 21 |
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
|
| 23 |
def _resolve_weights_path() -> str:
|
| 24 |
"""
|
|
@@ -138,6 +150,7 @@ demo = gr.Interface(
|
|
| 138 |
"Space에 가중치(`checkpoints/model_best.pth`)가 포함되어 있거나, "
|
| 139 |
"환경변수 WEIGHTS_REPO/WEIGHTS_FILENAME로 Hub에서 내려받을 수 있어야 합니다."
|
| 140 |
),
|
|
|
|
| 141 |
)
|
| 142 |
|
| 143 |
if __name__ == "__main__":
|
|
|
|
| 4 |
import torch
|
| 5 |
import torch.nn.functional as F
|
| 6 |
from skimage import img_as_ubyte
|
| 7 |
+
from glob import glob
|
| 8 |
|
| 9 |
from models import find_models_def
|
| 10 |
|
|
|
|
| 20 |
MODEL = None
|
| 21 |
DEVICE = "cuda" if torch.cuda.is_available() else "cpu"
|
| 22 |
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
|
| 23 |
+
EXAMPLES_DIR = os.path.join(BASE_DIR, "examples")
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
def _list_example_images() -> list[str]:
|
| 27 |
+
if not os.path.isdir(EXAMPLES_DIR):
|
| 28 |
+
return []
|
| 29 |
+
exts = ("*.png", "*.jpg", "*.jpeg", "*.webp")
|
| 30 |
+
paths: list[str] = []
|
| 31 |
+
for ext in exts:
|
| 32 |
+
paths.extend(glob(os.path.join(EXAMPLES_DIR, ext)))
|
| 33 |
+
return sorted(paths)
|
| 34 |
|
| 35 |
def _resolve_weights_path() -> str:
|
| 36 |
"""
|
|
|
|
| 150 |
"Space에 가중치(`checkpoints/model_best.pth`)가 포함되어 있거나, "
|
| 151 |
"환경변수 WEIGHTS_REPO/WEIGHTS_FILENAME로 Hub에서 내려받을 수 있어야 합니다."
|
| 152 |
),
|
| 153 |
+
examples=_list_example_images(),
|
| 154 |
)
|
| 155 |
|
| 156 |
if __name__ == "__main__":
|
examples/rain200h_1.png
ADDED
|
Git LFS Details
|
examples/rain200h_2.png
ADDED
|
Git LFS Details
|
examples/rain200h_3.png
ADDED
|
Git LFS Details
|