hysts HF staff commited on
Commit
c8910cc
β€’
1 Parent(s): 3fc678c

Add sample images

Browse files
app.py CHANGED
@@ -3,6 +3,7 @@
3
  from __future__ import annotations
4
 
5
  import argparse
 
6
 
7
  import gradio as gr
8
  import numpy as np
@@ -28,18 +29,20 @@ def parse_args() -> argparse.Namespace:
28
  return parser.parse_args()
29
 
30
 
31
- def get_sample_image_url(model_name: str) -> str:
32
  sample_image_dir = 'https://huggingface.co/spaces/hysts/Self-Distilled-StyleGAN/resolve/main/samples'
33
- return f'{sample_image_dir}/{model_name}.jpg'
34
 
35
 
36
- def get_sample_image_markdown(model_name: str) -> str:
37
- url = get_sample_image_url(model_name)
38
- size = model_name.split('_')[-1]
 
39
  return f'''
40
  - size: {size}x{size}
41
  - seed: 0-99
42
  - truncation: 0.7
 
43
  ![sample images]({url})'''
44
 
45
 
@@ -88,14 +91,19 @@ def main():
88
  run_button = gr.Button('Run')
89
  with gr.Column():
90
  result = gr.Image(label='Result', elem_id='result')
 
91
  with gr.TabItem('Sample Images'):
92
  with gr.Row():
93
- model_name2 = gr.Dropdown(model.MODEL_NAMES,
94
- value=model.MODEL_NAMES[0],
95
- label='Model')
 
 
 
96
  with gr.Row():
97
  text = get_sample_image_markdown(model_name2.value)
98
  sample_images = gr.Markdown(text)
 
99
  with gr.TabItem('Cluster Center Images'):
100
  with gr.Row():
101
  model_name3 = gr.Dropdown(model.MODEL_NAMES,
 
3
  from __future__ import annotations
4
 
5
  import argparse
6
+ import pathlib
7
 
8
  import gradio as gr
9
  import numpy as np
 
29
  return parser.parse_args()
30
 
31
 
32
+ def get_sample_image_url(name: str) -> str:
33
  sample_image_dir = 'https://huggingface.co/spaces/hysts/Self-Distilled-StyleGAN/resolve/main/samples'
34
+ return f'{sample_image_dir}/{name}.jpg'
35
 
36
 
37
+ def get_sample_image_markdown(name: str) -> str:
38
+ url = get_sample_image_url(name)
39
+ size = name.split('_')[1]
40
+ truncation_type = '_'.join(name.split('_')[2:])
41
  return f'''
42
  - size: {size}x{size}
43
  - seed: 0-99
44
  - truncation: 0.7
45
+ - truncation type: {truncation_type}
46
  ![sample images]({url})'''
47
 
48
 
 
91
  run_button = gr.Button('Run')
92
  with gr.Column():
93
  result = gr.Image(label='Result', elem_id='result')
94
+
95
  with gr.TabItem('Sample Images'):
96
  with gr.Row():
97
+ paths = sorted(pathlib.Path('samples').glob('*'))
98
+ names = [path.stem for path in paths]
99
+ model_name2 = gr.Dropdown(
100
+ names,
101
+ value='dogs_1024_multimodal_lpips',
102
+ label='Type')
103
  with gr.Row():
104
  text = get_sample_image_markdown(model_name2.value)
105
  sample_images = gr.Markdown(text)
106
+
107
  with gr.TabItem('Cluster Center Images'):
108
  with gr.Row():
109
  model_name3 = gr.Dropdown(model.MODEL_NAMES,
samples/{bicycles_256.jpg β†’ bicycles_256_global.jpg} RENAMED
File without changes
samples/{horses_256.jpg β†’ bicycles_256_multimodal_l2.jpg} RENAMED
File without changes
samples/{parrots_512.jpg β†’ bicycles_256_multimodal_lpips.jpg} RENAMED
File without changes
samples/{dogs_1024.jpg β†’ dogs_1024_global.jpg} RENAMED
File without changes
samples/{elephants_512.jpg β†’ dogs_1024_multimodal_l2.jpg} RENAMED
File without changes
samples/{giraffes_512.jpg β†’ dogs_1024_multimodal_lpips.jpg} RENAMED
File without changes
samples/elephants_512_global.jpg ADDED

Git LFS Details

  • SHA256: 0a7454098794427b946405ab4acb3af2da50097cc8ab0f2068a1b7b49af16343
  • Pointer size: 133 Bytes
  • Size of remote file: 12.1 MB
samples/elephants_512_multimodal_l2.jpg ADDED

Git LFS Details

  • SHA256: dcea1f74b5acf885c9df7f49b66f66a66134c741be013bc1e74145952ddf27da
  • Pointer size: 133 Bytes
  • Size of remote file: 12 MB
samples/elephants_512_multimodal_lpips.jpg ADDED

Git LFS Details

  • SHA256: 5ad535f24a634eb6a51d87ac5ddb3dcdb8ee0c44bdb7eb8342851069fbee7d45
  • Pointer size: 133 Bytes
  • Size of remote file: 11.8 MB
samples/giraffes_512_global.jpg ADDED

Git LFS Details

  • SHA256: d2df09be7e8305d6a4448b1d2c060340c67dbdaa461a2145e49f74deb6c59bab
  • Pointer size: 133 Bytes
  • Size of remote file: 10.6 MB
samples/giraffes_512_multimodal_l2.jpg ADDED

Git LFS Details

  • SHA256: def18b83f88b8c4ae5da399db7f61073c4fc757487ddc3a99f41e59821493a5a
  • Pointer size: 133 Bytes
  • Size of remote file: 10.4 MB
samples/giraffes_512_multimodal_lpips.jpg ADDED

Git LFS Details

  • SHA256: 75e1c466cdf2a4b302584c139b0e23d798a8cb031828a489352c1b9720339f84
  • Pointer size: 133 Bytes
  • Size of remote file: 10.4 MB
samples/horses_256_global.jpg ADDED

Git LFS Details

  • SHA256: be290bc1bf68aa5b1ed2fc2a267453868cb9cba64697dc38274b1e9068b7004a
  • Pointer size: 132 Bytes
  • Size of remote file: 3.15 MB
samples/horses_256_multimodal_l2.jpg ADDED

Git LFS Details

  • SHA256: 5f8873d00066b11742c2d8e37f59e415757a6fbaefe36b60aa15235192700cb4
  • Pointer size: 132 Bytes
  • Size of remote file: 3.12 MB
samples/horses_256_multimodal_lpips.jpg ADDED

Git LFS Details

  • SHA256: 0de60b0c30d46bd2194a23299dbc7541dbc3a389fe14502e9aac2acc9be85cff
  • Pointer size: 132 Bytes
  • Size of remote file: 3.13 MB
samples/lions_512.jpg DELETED

Git LFS Details

  • SHA256: 6ea7b36ca52b76476be1736292ab05e0a140151cd8353deeb31d131dcbb7f60c
  • Pointer size: 133 Bytes
  • Size of remote file: 11.2 MB
samples/lions_512_global.jpg ADDED

Git LFS Details

  • SHA256: 239cdf4156b42105787baedc5334d5044ab9bfe3340dcfd7353c2c6e0eae7e03
  • Pointer size: 133 Bytes
  • Size of remote file: 11.3 MB
samples/lions_512_multimodal_l2.jpg ADDED

Git LFS Details

  • SHA256: 6f85c3528c313ccc8534c71ea242a02183d9e5cf6c20ab0cad18e22e39d0be8c
  • Pointer size: 133 Bytes
  • Size of remote file: 11.2 MB
samples/lions_512_multimodal_lpips.jpg ADDED

Git LFS Details

  • SHA256: a404d939b181cc708a3569458fee55eed72e5c66e550d23c3e77478787dd85a4
  • Pointer size: 133 Bytes
  • Size of remote file: 11.1 MB
samples/parrots_512_global.jpg ADDED

Git LFS Details

  • SHA256: 3e77e7c12316d1855962d62cd2fbf9eda4c5cc5416e69f570a841be70ff3347f
  • Pointer size: 132 Bytes
  • Size of remote file: 6.71 MB
samples/parrots_512_multimodal_l2.jpg ADDED

Git LFS Details

  • SHA256: d743d436eb3585d0cb60a0b600d2db73ecb3b01558485281ff993ff39fe7c460
  • Pointer size: 132 Bytes
  • Size of remote file: 6.94 MB
samples/parrots_512_multimodal_lpips.jpg ADDED

Git LFS Details

  • SHA256: 5b5346871f6d5b15f5b6d570a1adef7c48516a6326e332232b5df8fd25eebe0f
  • Pointer size: 132 Bytes
  • Size of remote file: 6.93 MB