huzefa11 commited on
Commit
aa074bd
·
verified ·
1 Parent(s): f8a8837

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -8
app.py CHANGED
@@ -58,10 +58,11 @@ def set_text_unfinished():
58
  def set_text_finished():
59
  return gr.update(visible=True, value="<h3>Generation Finished</h3>")
60
  #################################################
61
- def get_image_path_list(folder_name):
62
- image_basename_list = os.listdir(folder_name)
63
- image_path_list = sorted([os.path.join(folder_name, basename) for basename in image_basename_list])
64
- return image_path_list
 
65
 
66
  #################################################
67
  class SpatialAttnProcessor2_0(torch.nn.Module):
@@ -752,7 +753,7 @@ with gr.Blocks(css=css) as demo:
752
  "Chasing a man on the street.",
753
  "At the police station.",
754
  ]),
755
- "Japanese Anime","Using Ref Images",get_image_path_list('./ironman.jpeg'),768,768
756
  ],
757
  [1,0.5,0.5,3,"a woman img, wearing a white T-shirt, blue loose hair",
758
  "bad anatomy, bad hands, missing fingers, extra fingers, three hands, three legs, bad arms, missing legs, missing arms, poorly drawn face, bad face, fused face, cloned face, three crus, fused feet, fused thigh, extra crus, ugly fingers, horn, cartoon, cg, 3d, unreal, animate, amputation, disconnected limbs",
@@ -762,7 +763,7 @@ with gr.Blocks(css=css) as demo:
762
  "work in the company",
763
  "Take a walk next to the company at noon",
764
  "lying in bed at night"]),
765
- "Japanese Anime", "Using Ref Images",get_image_path_list('./yennlecun.png'),768,768
766
  ],
767
  [0,0.5,0.5,3,"a man, wearing black jacket",
768
  "bad anatomy, bad hands, missing fingers, extra fingers, three hands, three legs, bad arms, missing legs, missing arms, poorly drawn face, bad face, fused face, cloned face, three crus, fused feet, fused thigh, extra crus, ugly fingers, horn, cartoon, cg, 3d, unreal, animate, amputation, disconnected limbs",
@@ -773,7 +774,7 @@ with gr.Blocks(css=css) as demo:
773
  "laughing happily",
774
  "lying in bed at night"
775
  ]),
776
- "Japanese Anime","Only Using Textual Description",get_image_path_list('./ironman.jpeg'),768,768
777
  ],
778
  [0,0.3,0.5,3,"a girl, wearing white shirt, black skirt, black tie, yellow hair",
779
  "bad anatomy, bad hands, missing fingers, extra fingers, three hands, three legs, bad arms, missing legs, missing arms, poorly drawn face, bad face, fused face, cloned face, three crus, fused feet, fused thigh, extra crus, ugly fingers, horn, cartoon, cg, 3d, unreal, animate, amputation, disconnected limbs",
@@ -788,7 +789,7 @@ with gr.Blocks(css=css) as demo:
788
  "[NC]The brown squirrel appear.",
789
  "is very happy # She is very happy to see the squirrel again",
790
  "[NC]The brown squirrel takes the cracker and scampers up a tree. # She gives the squirrel cracker"]),
791
- "Japanese Anime","Only Using Textual Description",get_image_path_list('./taylor.png'),768,768
792
  ]
793
  ],
794
  inputs=[seed_, sa32_, sa64_, id_length_, general_prompt, negative_prompt, prompt_array,style,model_type,files,G_height,G_width],
 
58
  def set_text_finished():
59
  return gr.update(visible=True, value="<h3>Generation Finished</h3>")
60
  #################################################
61
+ def get_image_path(image_path):
62
+ if os.path.exists(image_path):
63
+ return [image_path] # Return the image path in a list
64
+ else:
65
+ raise FileNotFoundError(f"Image not found: {image_path}")
66
 
67
  #################################################
68
  class SpatialAttnProcessor2_0(torch.nn.Module):
 
753
  "Chasing a man on the street.",
754
  "At the police station.",
755
  ]),
756
+ "Japanese Anime","Using Ref Images",get_image_path('./ironman.jpeg'),768,768
757
  ],
758
  [1,0.5,0.5,3,"a woman img, wearing a white T-shirt, blue loose hair",
759
  "bad anatomy, bad hands, missing fingers, extra fingers, three hands, three legs, bad arms, missing legs, missing arms, poorly drawn face, bad face, fused face, cloned face, three crus, fused feet, fused thigh, extra crus, ugly fingers, horn, cartoon, cg, 3d, unreal, animate, amputation, disconnected limbs",
 
763
  "work in the company",
764
  "Take a walk next to the company at noon",
765
  "lying in bed at night"]),
766
+ "Japanese Anime", "Using Ref Images",get_image_path('./yennlecun.png'),768,768
767
  ],
768
  [0,0.5,0.5,3,"a man, wearing black jacket",
769
  "bad anatomy, bad hands, missing fingers, extra fingers, three hands, three legs, bad arms, missing legs, missing arms, poorly drawn face, bad face, fused face, cloned face, three crus, fused feet, fused thigh, extra crus, ugly fingers, horn, cartoon, cg, 3d, unreal, animate, amputation, disconnected limbs",
 
774
  "laughing happily",
775
  "lying in bed at night"
776
  ]),
777
+ "Japanese Anime","Only Using Textual Description",get_image_path('./ironman.jpeg'),768,768
778
  ],
779
  [0,0.3,0.5,3,"a girl, wearing white shirt, black skirt, black tie, yellow hair",
780
  "bad anatomy, bad hands, missing fingers, extra fingers, three hands, three legs, bad arms, missing legs, missing arms, poorly drawn face, bad face, fused face, cloned face, three crus, fused feet, fused thigh, extra crus, ugly fingers, horn, cartoon, cg, 3d, unreal, animate, amputation, disconnected limbs",
 
789
  "[NC]The brown squirrel appear.",
790
  "is very happy # She is very happy to see the squirrel again",
791
  "[NC]The brown squirrel takes the cracker and scampers up a tree. # She gives the squirrel cracker"]),
792
+ "Japanese Anime","Only Using Textual Description",get_image_path('./taylor.png'),768,768
793
  ]
794
  ],
795
  inputs=[seed_, sa32_, sa64_, id_length_, general_prompt, negative_prompt, prompt_array,style,model_type,files,G_height,G_width],