Spaces:
Running
Running
Commit
•
5975e3b
1
Parent(s):
ab0ddbd
app.py: fixed examples.
Browse files
app.py
CHANGED
@@ -172,7 +172,7 @@ def get_example ():
|
|
172 |
case = [
|
173 |
[
|
174 |
'./examples/yann-lecun_resize.jpg',
|
175 |
-
|
176 |
'a man',
|
177 |
'Spring Festival',
|
178 |
'(lowres, low quality, worst quality:1.2), (text:1.2), watermark, (frame:1.2), deformed, ugly, deformed eyes, blur, out of focus, blurry, deformed cat, deformed, photo, anthropomorphic cat, monochrome, photo, pet collar, gun, weapon, blue, 3d, drones, drone, buildings in background, green',
|
@@ -209,32 +209,11 @@ def get_example ():
|
|
209 |
return case
|
210 |
|
211 |
|
212 |
-
def
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
# model_name,
|
218 |
-
# face_file,
|
219 |
-
# pose_file,
|
220 |
-
# prompt,
|
221 |
-
# negative_prompt,
|
222 |
-
# style,
|
223 |
-
# 20, # num_steps
|
224 |
-
# 0.8, # identitynet_strength_ratio
|
225 |
-
# 0.8, # adapter_strength_ratio
|
226 |
-
# 0.4, # pose_strength
|
227 |
-
# 0.3, # canny_strength
|
228 |
-
# 0.5, # depth_strength
|
229 |
-
# ['pose', 'canny'], # controlnet_selection
|
230 |
-
# 5.0, # guidance_scale
|
231 |
-
# 42, # seed
|
232 |
-
# 'Euler a', # scheduler
|
233 |
-
# #False, # enable_LCM
|
234 |
-
# True, # enable_Face_Region
|
235 |
-
#)
|
236 |
-
return None, gr.update(visible=True)
|
237 |
-
return run_for_examples
|
238 |
|
239 |
|
240 |
def generate_image (
|
@@ -552,14 +531,13 @@ with gr.Blocks(css=css) as demo:
|
|
552 |
# queue=False,
|
553 |
#)
|
554 |
|
555 |
-
|
556 |
-
|
557 |
-
|
558 |
-
|
559 |
-
|
560 |
-
|
561 |
-
|
562 |
-
#)
|
563 |
|
564 |
gr.Markdown(article)
|
565 |
|
|
|
172 |
case = [
|
173 |
[
|
174 |
'./examples/yann-lecun_resize.jpg',
|
175 |
+
None,
|
176 |
'a man',
|
177 |
'Spring Festival',
|
178 |
'(lowres, low quality, worst quality:1.2), (text:1.2), watermark, (frame:1.2), deformed, ugly, deformed eyes, blur, out of focus, blurry, deformed cat, deformed, photo, anthropomorphic cat, monochrome, photo, pet collar, gun, weapon, blue, 3d, drones, drone, buildings in background, green',
|
|
|
209 |
return case
|
210 |
|
211 |
|
212 |
+
def load_example (face_file, pose_file, prompt, style, negative_prompt):
|
213 |
+
name = os.path.basename(face_file).split('_')[0]
|
214 |
+
image = PIL.Image.open(open(f'./examples/generated/{name}.jpg', 'rb'))
|
215 |
+
|
216 |
+
return image, gr.update(visible=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
217 |
|
218 |
|
219 |
def generate_image (
|
|
|
531 |
# queue=False,
|
532 |
#)
|
533 |
|
534 |
+
gr.Examples(
|
535 |
+
examples=get_example(),
|
536 |
+
inputs=[face_file, pose_file, prompt, style, negative_prompt],
|
537 |
+
fn=load_example,
|
538 |
+
outputs=[gallery, usage_tips],
|
539 |
+
cache_examples=True,
|
540 |
+
)
|
|
|
541 |
|
542 |
gr.Markdown(article)
|
543 |
|