Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -163,14 +163,12 @@ def create_demo(args, model_name: str, device: str = "cuda" if torch.cuda.is_ava
|
|
163 |
|
164 |
with gr.Blocks(theme="Nymbo/Nymbo_Theme", css=css) as demo:
|
165 |
|
166 |
-
|
167 |
with gr.Row():
|
168 |
with gr.Column():
|
169 |
prompt = gr.Textbox(label="Prompt", value="portrait, color, cinematic")
|
170 |
id_image = gr.Image(label="ID Image")
|
171 |
id_weight = gr.Slider(0.0, 3.0, 1, step=0.05, label="id weight")
|
172 |
|
173 |
-
|
174 |
width = gr.Slider(256, 1536, 896, step=16, label="Width")
|
175 |
height = gr.Slider(256, 1536, 1152, step=16, label="Height")
|
176 |
num_steps = gr.Slider(1, 20, 20, step=1, label="Number of steps")
|
@@ -193,70 +191,51 @@ def create_demo(args, model_name: str, device: str = "cuda" if torch.cuda.is_ava
|
|
193 |
output_image = gr.Image(label="Generated Image")
|
194 |
seed_output = gr.Textbox(label="Used Seed")
|
195 |
intermediate_output = gr.Gallery(label='Output', elem_id="gallery", visible=args.dev)
|
196 |
-
# _CITE_ ๊ด๋ จ ๋ถ๋ถ ์ ๊ฑฐ
|
197 |
-
|
198 |
|
199 |
-
with gr.Row()
|
|
|
200 |
gr.Markdown("## Examples")
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
],
|
207 |
-
[
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
],
|
212 |
-
[
|
213 |
-
|
214 |
-
'example_inputs/liuyifei.png',
|
215 |
-
4, 4, 6349424134217931066, 1
|
216 |
-
],
|
217 |
-
[
|
218 |
-
'a young child is eating Icecream',
|
219 |
-
'example_inputs/liuyifei.png',
|
220 |
-
4, 4, 10606046113565776207, 1
|
221 |
-
],
|
222 |
-
[
|
223 |
-
'a man is holding a sign with text \"PuLID for FLUX\", winter, snowing, top of the mountain',
|
224 |
-
'example_inputs/pengwei.jpg',
|
225 |
-
4, 4, 2410129802683836089, 1
|
226 |
-
],
|
227 |
-
[
|
228 |
-
'portrait, candle light',
|
229 |
-
'example_inputs/pengwei.jpg',
|
230 |
-
4, 4, 17522759474323955700, 1
|
231 |
-
],
|
232 |
-
[
|
233 |
-
'profile shot dark photo of a 25-year-old male with smoke escaping from his mouth, the backlit smoke gives the image an ephemeral quality, natural face, natural eyebrows, natural skin texture, award winning photo, highly detailed face, atmospheric lighting, film grain, monochrome', # noqa E501
|
234 |
-
'example_inputs/pengwei.jpg',
|
235 |
-
4, 4, 17733156847328193625, 1
|
236 |
-
],
|
237 |
-
[
|
238 |
-
'American Comics, 1boy',
|
239 |
-
'example_inputs/pengwei.jpg',
|
240 |
-
1, 4, 13223174453874179686, 1
|
241 |
-
],
|
242 |
-
[
|
243 |
-
'portrait, pixar',
|
244 |
-
'example_inputs/pengwei.jpg',
|
245 |
-
1, 4, 9445036702517583939, 1
|
246 |
-
],
|
247 |
-
]
|
248 |
-
gr.Examples(examples=example_inps, inputs=[prompt, id_image, start_step, guidance, seed, true_cfg],
|
249 |
-
label='fake CFG')
|
250 |
-
|
251 |
-
example_inps = [
|
252 |
-
[
|
253 |
-
'portrait, made of ice sculpture',
|
254 |
-
'example_inputs/lecun.jpg',
|
255 |
-
1, 1, 3811899118709451814, 5
|
256 |
-
],
|
257 |
]
|
258 |
-
|
259 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
260 |
|
261 |
generate_btn.click(
|
262 |
fn=generate_image,
|
|
|
163 |
|
164 |
with gr.Blocks(theme="Nymbo/Nymbo_Theme", css=css) as demo:
|
165 |
|
|
|
166 |
with gr.Row():
|
167 |
with gr.Column():
|
168 |
prompt = gr.Textbox(label="Prompt", value="portrait, color, cinematic")
|
169 |
id_image = gr.Image(label="ID Image")
|
170 |
id_weight = gr.Slider(0.0, 3.0, 1, step=0.05, label="id weight")
|
171 |
|
|
|
172 |
width = gr.Slider(256, 1536, 896, step=16, label="Width")
|
173 |
height = gr.Slider(256, 1536, 1152, step=16, label="Height")
|
174 |
num_steps = gr.Slider(1, 20, 20, step=1, label="Number of steps")
|
|
|
191 |
output_image = gr.Image(label="Generated Image")
|
192 |
seed_output = gr.Textbox(label="Used Seed")
|
193 |
intermediate_output = gr.Gallery(label='Output', elem_id="gallery", visible=args.dev)
|
|
|
|
|
194 |
|
195 |
+
with gr.Row():
|
196 |
+
with gr.Column():
|
197 |
gr.Markdown("## Examples")
|
198 |
+
|
199 |
+
# ๋ชจ๋ ์์๋ฅผ ํ๋์ ๋ฆฌ์คํธ๋ก ํฉ์นฉ๋๋ค
|
200 |
+
all_examples = [
|
201 |
+
['a woman holding sign with glowing green text \"PuLID for FLUX\"', 'example_inputs/liuyifei.png', 4, 4, 2680261499100305976, 1],
|
202 |
+
['portrait, side view', 'example_inputs/liuyifei.png', 4, 4, 1205240166692517553, 1],
|
203 |
+
['white-haired woman with vr technology atmosphere, revolutionary exceptional magnum with remarkable details', 'example_inputs/liuyifei.png', 4, 4, 6349424134217931066, 1],
|
204 |
+
['a young child is eating Icecream', 'example_inputs/liuyifei.png', 4, 4, 10606046113565776207, 1],
|
205 |
+
['a man is holding a sign with text \"PuLID for FLUX\", winter, snowing, top of the mountain', 'example_inputs/pengwei.jpg', 4, 4, 2410129802683836089, 1],
|
206 |
+
['portrait, candle light', 'example_inputs/pengwei.jpg', 4, 4, 17522759474323955700, 1],
|
207 |
+
['profile shot dark photo of a 25-year-old male with smoke escaping from his mouth, the backlit smoke gives the image an ephemeral quality, natural face, natural eyebrows, natural skin texture, award winning photo, highly detailed face, atmospheric lighting, film grain, monochrome', 'example_inputs/pengwei.jpg', 4, 4, 17733156847328193625, 1],
|
208 |
+
['American Comics, 1boy', 'example_inputs/pengwei.jpg', 1, 4, 13223174453874179686, 1],
|
209 |
+
['portrait, pixar', 'example_inputs/pengwei.jpg', 1, 4, 9445036702517583939, 1],
|
210 |
+
['portrait, made of ice sculpture', 'example_inputs/lecun.jpg', 1, 1, 3811899118709451814, 5],
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
211 |
]
|
212 |
+
|
213 |
+
# ์์ ์ด๋ฏธ์ง์ ์บก์
์ ์ค๋นํฉ๋๋ค
|
214 |
+
example_images = [example[1] for example in all_examples]
|
215 |
+
example_captions = [example[0] for example in all_examples]
|
216 |
+
|
217 |
+
# Gallery ์ปดํฌ๋ํธ๋ฅผ ์ฌ์ฉํ์ฌ ๊ทธ๋ฆฌ๋ ํํ๋ก ์์๋ค์ ํ์ํฉ๋๋ค
|
218 |
+
gallery = gr.Gallery(
|
219 |
+
label="Example Gallery",
|
220 |
+
show_label=False,
|
221 |
+
elem_id="gallery",
|
222 |
+
columns=5,
|
223 |
+
rows=2,
|
224 |
+
object_fit="contain",
|
225 |
+
height="auto"
|
226 |
+
).style(grid=5, height="auto")
|
227 |
+
|
228 |
+
gallery.value = list(zip(example_images, example_captions))
|
229 |
+
|
230 |
+
# ์์ ํด๋ฆญ ์ ์
๋ ฅ ํ๋์ ๊ฐ์ ์ฑ์ฐ๋ ํจ์
|
231 |
+
def fill_example(evt: gr.SelectData):
|
232 |
+
return [all_examples[evt.index][i] for i in [0, 1, 2, 3, 4, 5]]
|
233 |
+
|
234 |
+
gallery.select(
|
235 |
+
fill_example,
|
236 |
+
None,
|
237 |
+
[prompt, id_image, start_step, guidance, seed, true_cfg],
|
238 |
+
)
|
239 |
|
240 |
generate_btn.click(
|
241 |
fn=generate_image,
|