Spaces:
Running
on
Zero
Running
on
Zero
Richard Neuschulz
commited on
Commit
·
f233c1b
1
Parent(s):
f7bec2c
uppdated app.py
Browse files
app.py
CHANGED
@@ -48,7 +48,7 @@ def generate_image(images, prompt, negative_prompt, face_strength, likeness_stre
|
|
48 |
# Start the process
|
49 |
pipe.to(device)
|
50 |
app = FaceAnalysis(name="buffalo_l", providers=['CUDAExecutionProvider', 'CPUExecutionProvider'])
|
51 |
-
app.prepare(ctx_id=0, det_size=(
|
52 |
|
53 |
faceid_all_embeds = []
|
54 |
for image in images:
|
@@ -67,6 +67,9 @@ 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 |
print(image)
|
71 |
return image
|
72 |
|
@@ -93,7 +96,7 @@ with gr.Blocks(css=css) as demo:
|
|
93 |
prompt = gr.Textbox(label="Prompt",
|
94 |
info="Try something like 'a photo of a man/woman/person'",
|
95 |
placeholder="A photo of a [man/woman/person]...",
|
96 |
-
value="A photo of a man, professional photoshoot, plain black shirt, on plain black background, shaved head, trimmed beard,
|
97 |
negative_prompt = gr.Textbox(label="Negative Prompt", placeholder="low quality", value="low quality, worst quality")
|
98 |
style = "Photorealistic"
|
99 |
submit = gr.Button("Submit")
|
|
|
48 |
# Start the process
|
49 |
pipe.to(device)
|
50 |
app = FaceAnalysis(name="buffalo_l", providers=['CUDAExecutionProvider', 'CPUExecutionProvider'])
|
51 |
+
app.prepare(ctx_id=0, det_size=(512, 512))
|
52 |
|
53 |
faceid_all_embeds = []
|
54 |
for image in images:
|
|
|
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 |
|
|
|
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 |
submit = gr.Button("Submit")
|