SeunghoEum commited on
Commit
2dda8cb
·
1 Parent(s): c0ec995

Add example images to the UI

Browse files
.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

  • SHA256: af7919dd4e36866f8f8542a2584c422d17deb9e4a8825104d23b4943f670391c
  • Pointer size: 131 Bytes
  • Size of remote file: 339 kB
examples/rain200h_2.png ADDED

Git LFS Details

  • SHA256: 46756a7fab48da7f7c36dbd20552046e253f84d3e667640281e4fec6e4472bc8
  • Pointer size: 131 Bytes
  • Size of remote file: 386 kB
examples/rain200h_3.png ADDED

Git LFS Details

  • SHA256: 0f334393c48ee481490b8fbf76087d0e8396d1ab65f91d2ea8ea5e93f6c427fb
  • Pointer size: 131 Bytes
  • Size of remote file: 392 kB