Add sample images
Browse files- app.py +16 -8
- samples/{bicycles_256.jpg β bicycles_256_global.jpg} +2 -2
- samples/{horses_256.jpg β bicycles_256_multimodal_l2.jpg} +2 -2
- samples/{parrots_512.jpg β bicycles_256_multimodal_lpips.jpg} +2 -2
- samples/{dogs_1024.jpg β dogs_1024_global.jpg} +2 -2
- samples/{elephants_512.jpg β dogs_1024_multimodal_l2.jpg} +2 -2
- samples/{giraffes_512.jpg β dogs_1024_multimodal_lpips.jpg} +2 -2
- samples/elephants_512_global.jpg +3 -0
- samples/elephants_512_multimodal_l2.jpg +3 -0
- samples/elephants_512_multimodal_lpips.jpg +3 -0
- samples/giraffes_512_global.jpg +3 -0
- samples/giraffes_512_multimodal_l2.jpg +3 -0
- samples/giraffes_512_multimodal_lpips.jpg +3 -0
- samples/horses_256_global.jpg +3 -0
- samples/horses_256_multimodal_l2.jpg +3 -0
- samples/horses_256_multimodal_lpips.jpg +3 -0
- samples/lions_512.jpg +0 -3
- samples/lions_512_global.jpg +3 -0
- samples/lions_512_multimodal_l2.jpg +3 -0
- samples/lions_512_multimodal_lpips.jpg +3 -0
- samples/parrots_512_global.jpg +3 -0
- samples/parrots_512_multimodal_l2.jpg +3 -0
- samples/parrots_512_multimodal_lpips.jpg +3 -0
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(
|
32 |
sample_image_dir = 'https://huggingface.co/spaces/hysts/Self-Distilled-StyleGAN/resolve/main/samples'
|
33 |
-
return f'{sample_image_dir}/{
|
34 |
|
35 |
|
36 |
-
def get_sample_image_markdown(
|
37 |
-
url = get_sample_image_url(
|
38 |
-
size =
|
|
|
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 |
-
|
94 |
-
|
95 |
-
|
|
|
|
|
|
|
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
|
samples/elephants_512_multimodal_l2.jpg
ADDED
![]() |
Git LFS Details
|
samples/elephants_512_multimodal_lpips.jpg
ADDED
![]() |
Git LFS Details
|
samples/giraffes_512_global.jpg
ADDED
![]() |
Git LFS Details
|
samples/giraffes_512_multimodal_l2.jpg
ADDED
![]() |
Git LFS Details
|
samples/giraffes_512_multimodal_lpips.jpg
ADDED
![]() |
Git LFS Details
|
samples/horses_256_global.jpg
ADDED
![]() |
Git LFS Details
|
samples/horses_256_multimodal_l2.jpg
ADDED
![]() |
Git LFS Details
|
samples/horses_256_multimodal_lpips.jpg
ADDED
![]() |
Git LFS Details
|
samples/lions_512.jpg
DELETED
Git LFS Details
|
samples/lions_512_global.jpg
ADDED
![]() |
Git LFS Details
|
samples/lions_512_multimodal_l2.jpg
ADDED
![]() |
Git LFS Details
|
samples/lions_512_multimodal_lpips.jpg
ADDED
![]() |
Git LFS Details
|
samples/parrots_512_global.jpg
ADDED
![]() |
Git LFS Details
|
samples/parrots_512_multimodal_l2.jpg
ADDED
![]() |
Git LFS Details
|
samples/parrots_512_multimodal_lpips.jpg
ADDED
![]() |
Git LFS Details
|