Spaces:
Running
on
Zero
Running
on
Zero
Richard Neuschulz
commited on
Commit
•
4c6b687
1
Parent(s):
e019702
updated app.py
Browse files
app.py
CHANGED
@@ -34,9 +34,6 @@ pipe = StableDiffusionXLPipeline.from_pretrained(
|
|
34 |
#safety_checker=safety_checker
|
35 |
)
|
36 |
|
37 |
-
#pipe.load_lora_weights("h94/IP-Adapter-FaceID", weight_name="ip-adapter-faceid-plusv2_sd15_lora.safetensors")
|
38 |
-
#pipe.fuse_lora()
|
39 |
-
|
40 |
ip_model = ipown.IPAdapterFaceIDXL(pipe, ip_ckpt, device)
|
41 |
|
42 |
@spaces.GPU(enable_queue=True)
|
@@ -67,9 +64,6 @@ def generate_image(images, prompt, negative_prompt, face_strength, likeness_stre
|
|
67 |
scale=likeness_strength, width=1024, height=1024, guidance_scale=face_strength, num_inference_steps=30
|
68 |
)
|
69 |
|
70 |
-
# Clear GPU memory
|
71 |
-
torch.cuda.empty_cache()
|
72 |
-
|
73 |
print(image)
|
74 |
return image
|
75 |
|
@@ -92,15 +86,15 @@ with gr.Blocks(css=css) as demo:
|
|
92 |
)
|
93 |
uploaded_files = gr.Gallery(label="Your images", visible=False, columns=5, rows=1, height=250)
|
94 |
with gr.Column(visible=False) as clear_button:
|
95 |
-
remove_and_reupload = gr.ClearButton(value="Remove and upload new ones", components=files, size="sm")
|
96 |
prompt = gr.Textbox(label="Prompt",
|
97 |
info="Try something like 'a photo of a man/woman/person'",
|
98 |
placeholder="A photo of a [man/woman/person]...",
|
99 |
value="A photo of a man, looking directly at camera, professional photoshoot, plain black shirt, on plain black background, shaved head, trimmed beard, stoic, dynamic lighting")
|
100 |
negative_prompt = gr.Textbox(label="Negative Prompt", placeholder="low quality", value="low quality, worst quality")
|
101 |
style = "Photorealistic"
|
102 |
-
face_strength = gr.Slider(label="Guidance Scale", info="
|
103 |
-
likeness_strength = gr.Slider(label="Scale", info="
|
104 |
submit = gr.Button("Submit", variant="primary")
|
105 |
with gr.Column():
|
106 |
gallery = gr.Gallery(label="Generated Images")
|
|
|
34 |
#safety_checker=safety_checker
|
35 |
)
|
36 |
|
|
|
|
|
|
|
37 |
ip_model = ipown.IPAdapterFaceIDXL(pipe, ip_ckpt, device)
|
38 |
|
39 |
@spaces.GPU(enable_queue=True)
|
|
|
64 |
scale=likeness_strength, width=1024, height=1024, guidance_scale=face_strength, num_inference_steps=30
|
65 |
)
|
66 |
|
|
|
|
|
|
|
67 |
print(image)
|
68 |
return image
|
69 |
|
|
|
86 |
)
|
87 |
uploaded_files = gr.Gallery(label="Your images", visible=False, columns=5, rows=1, height=250)
|
88 |
with gr.Column(visible=False) as clear_button:
|
89 |
+
remove_and_reupload = gr.ClearButton(value="Remove files and upload new ones", components=files, size="sm")
|
90 |
prompt = gr.Textbox(label="Prompt",
|
91 |
info="Try something like 'a photo of a man/woman/person'",
|
92 |
placeholder="A photo of a [man/woman/person]...",
|
93 |
value="A photo of a man, looking directly at camera, professional photoshoot, plain black shirt, on plain black background, shaved head, trimmed beard, stoic, dynamic lighting")
|
94 |
negative_prompt = gr.Textbox(label="Negative Prompt", placeholder="low quality", value="low quality, worst quality")
|
95 |
style = "Photorealistic"
|
96 |
+
face_strength = gr.Slider(label="Guidance Scale", info="How much importance is given to the prompt when generating images.", value=7.5, step=0.1, minimum=0, maximum=15)
|
97 |
+
likeness_strength = gr.Slider(label="Scale", info="How much importance is given to your uploaded files when generating images.", value=1.0, step=0.1, minimum=0, maximum=5)
|
98 |
submit = gr.Button("Submit", variant="primary")
|
99 |
with gr.Column():
|
100 |
gallery = gr.Gallery(label="Generated Images")
|