Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -79,7 +79,7 @@ pipe.FacialEncoder.to(device)
|
|
79 |
|
80 |
@spaces.GPU
|
81 |
def process(selected_template_images,costum_image,prompt
|
82 |
-
,negative_prompt,prompt_selected,retouching,model_selected_tab,prompt_selected_tab,width,height,merge_steps):
|
83 |
|
84 |
if model_selected_tab==0:
|
85 |
select_images = load_image(Image.open(selected_template_images))
|
@@ -95,6 +95,7 @@ def process(selected_template_images,costum_image,prompt
|
|
95 |
|
96 |
# hyper-parameter
|
97 |
num_steps = 50
|
|
|
98 |
# merge_steps = 30
|
99 |
|
100 |
@torch.inference_mode()
|
@@ -136,8 +137,8 @@ def process(selected_template_images,costum_image,prompt
|
|
136 |
negtive_prompt_group="((cross-eye)),((cross-eyed)),(((NFSW))),(nipple),((((ugly)))), (((duplicate))), ((morbid)), ((mutilated)), [out of frame], extra fingers, mutated hands, ((poorly drawn hands)), ((poorly drawn face)), (((mutation))), (((deformed))), ((ugly)), blurry, ((bad anatomy)), (((bad proportions))), ((extra limbs)), cloned face, (((disfigured))). out of frame, ugly, extra limbs, (bad anatomy), gross proportions, (malformed limbs), ((missing arms)), ((missing legs)), (((extra arms))), (((extra legs))), mutated hands, (fused fingers), (too many fingers), (((long neck)))"
|
137 |
negative_prompt = negative_prompt + negtive_prompt_group
|
138 |
|
139 |
-
seed = torch.randint(0, 1000, (1,)).item()
|
140 |
-
generator = torch.Generator(device=device).manual_seed(
|
141 |
|
142 |
images = pipe(
|
143 |
prompt=prompt,
|
@@ -214,6 +215,7 @@ with gr.Blocks(title="ConsistentID Demo") as demo:
|
|
214 |
width.release(lambda x,y: min(1280-x,y), inputs=[width,height], outputs=[height])
|
215 |
height.release(lambda x,y: min(1280-y,x), inputs=[width,height], outputs=[width])
|
216 |
merge_steps = gr.Slider(label="step starting to merge facial details(30 is recommended)",minimum=10,maximum=50,value=30,step=1)
|
|
|
217 |
|
218 |
btn = gr.Button("Run")
|
219 |
with gr.Column():
|
@@ -225,6 +227,6 @@ with gr.Blocks(title="ConsistentID Demo") as demo:
|
|
225 |
- Due to insufficient graphics memory on the demo server, there is an upper limit on the resolution for generating samples. We will support the generation of SDXL as soon as possible<br/><br/>
|
226 |
''')
|
227 |
btn.click(fn=process, inputs=[selected_template_images,costum_image,prompt,nagetive_prompt,prompt_selected,retouching
|
228 |
-
,model_selected_tab,prompt_selected_tab,width,height,merge_steps], outputs=out)
|
229 |
|
230 |
demo.launch()
|
|
|
79 |
|
80 |
@spaces.GPU
|
81 |
def process(selected_template_images,costum_image,prompt
|
82 |
+
,negative_prompt,prompt_selected,retouching,model_selected_tab,prompt_selected_tab,width,height,merge_steps,seed_set):
|
83 |
|
84 |
if model_selected_tab==0:
|
85 |
select_images = load_image(Image.open(selected_template_images))
|
|
|
95 |
|
96 |
# hyper-parameter
|
97 |
num_steps = 50
|
98 |
+
seed_set = torch.randint(0, 1000, (1,)).item()
|
99 |
# merge_steps = 30
|
100 |
|
101 |
@torch.inference_mode()
|
|
|
137 |
negtive_prompt_group="((cross-eye)),((cross-eyed)),(((NFSW))),(nipple),((((ugly)))), (((duplicate))), ((morbid)), ((mutilated)), [out of frame], extra fingers, mutated hands, ((poorly drawn hands)), ((poorly drawn face)), (((mutation))), (((deformed))), ((ugly)), blurry, ((bad anatomy)), (((bad proportions))), ((extra limbs)), cloned face, (((disfigured))). out of frame, ugly, extra limbs, (bad anatomy), gross proportions, (malformed limbs), ((missing arms)), ((missing legs)), (((extra arms))), (((extra legs))), mutated hands, (fused fingers), (too many fingers), (((long neck)))"
|
138 |
negative_prompt = negative_prompt + negtive_prompt_group
|
139 |
|
140 |
+
# seed = torch.randint(0, 1000, (1,)).item()
|
141 |
+
generator = torch.Generator(device=device).manual_seed(seed_set)
|
142 |
|
143 |
images = pipe(
|
144 |
prompt=prompt,
|
|
|
215 |
width.release(lambda x,y: min(1280-x,y), inputs=[width,height], outputs=[height])
|
216 |
height.release(lambda x,y: min(1280-y,x), inputs=[width,height], outputs=[width])
|
217 |
merge_steps = gr.Slider(label="step starting to merge facial details(30 is recommended)",minimum=10,maximum=50,value=30,step=1)
|
218 |
+
seed_set = gr.Slider(label="set the random seed for different results",minimum=1,maximum=2147483647,value=2024,step=1)
|
219 |
|
220 |
btn = gr.Button("Run")
|
221 |
with gr.Column():
|
|
|
227 |
- Due to insufficient graphics memory on the demo server, there is an upper limit on the resolution for generating samples. We will support the generation of SDXL as soon as possible<br/><br/>
|
228 |
''')
|
229 |
btn.click(fn=process, inputs=[selected_template_images,costum_image,prompt,nagetive_prompt,prompt_selected,retouching
|
230 |
+
,model_selected_tab,prompt_selected_tab,width,height,merge_steps,seed_set], outputs=out)
|
231 |
|
232 |
demo.launch()
|