Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -25,7 +25,7 @@ pipeline = AutoPipelineForImage2Image.from_pretrained("runwayml/stable-diffusion
|
|
25 |
def load_model(model_drop):
|
26 |
pipeline = AutoPipelineForImage2Image.from_pretrained("runwayml/stable-diffusion-v1-5", torch_dtype=torch.float32, use_safetensors=True)
|
27 |
|
28 |
-
def run_dif(prompt,im_path,model_drop,cnt):
|
29 |
print(f'im_path:: {im_path}')
|
30 |
print(f'im_path0:: {im_path.root[0]}')
|
31 |
print(f'im_path0.image.path:: {im_path.root[0].image.path}')
|
@@ -43,7 +43,7 @@ def run_dif(prompt,im_path,model_drop,cnt):
|
|
43 |
|
44 |
# pass prompt and image to pipeline
|
45 |
#image = pipeline(prompt, image=init_image, strength=0.8,guidance_scale=8.0,negative_prompt=negative_prompt,num_inference_steps=50).images[0]
|
46 |
-
image = pipeline(prompt, image=init_image, strength=
|
47 |
#make_image_grid([init_image, image], rows=1, cols=2)
|
48 |
out_box.append(image)
|
49 |
yield out_box,""
|
@@ -181,9 +181,13 @@ with gr.Blocks(css=css) as app:
|
|
181 |
with gr.Row():
|
182 |
with gr.Column():
|
183 |
inp=gr.Textbox(label="Prompt")
|
|
|
|
|
|
|
|
|
184 |
with gr.Row():
|
185 |
btn=gr.Button()
|
186 |
-
stop_btn=gr.Button()
|
187 |
with gr.Column():
|
188 |
inp_im=gr.Image(type='filepath')
|
189 |
im_btn=gr.Button("Image Grid")
|
@@ -195,6 +199,6 @@ with gr.Blocks(css=css) as app:
|
|
195 |
fingal=gr.Gallery(columns=10)
|
196 |
im_list=gr.Textbox()
|
197 |
im_btn.click(load_im,inp_im,[outp,im_list])
|
198 |
-
go_btn = btn.click(run_dif,[inp,outp,model_drop,cnt],[fingal,out_html])
|
199 |
stop_btn.click(None,None,None,cancels=[go_btn])
|
200 |
app.queue().launch()
|
|
|
25 |
def load_model(model_drop):
|
26 |
pipeline = AutoPipelineForImage2Image.from_pretrained("runwayml/stable-diffusion-v1-5", torch_dtype=torch.float32, use_safetensors=True)
|
27 |
|
28 |
+
def run_dif(prompt,im_path,model_drop,cnt,strength,guidance,infer):
|
29 |
print(f'im_path:: {im_path}')
|
30 |
print(f'im_path0:: {im_path.root[0]}')
|
31 |
print(f'im_path0.image.path:: {im_path.root[0].image.path}')
|
|
|
43 |
|
44 |
# pass prompt and image to pipeline
|
45 |
#image = pipeline(prompt, image=init_image, strength=0.8,guidance_scale=8.0,negative_prompt=negative_prompt,num_inference_steps=50).images[0]
|
46 |
+
image = pipeline(prompt, image=init_image, strength=float(strength),guidance_scale=float(guidance),num_inference_steps=int(infer)).images[0]
|
47 |
#make_image_grid([init_image, image], rows=1, cols=2)
|
48 |
out_box.append(image)
|
49 |
yield out_box,""
|
|
|
181 |
with gr.Row():
|
182 |
with gr.Column():
|
183 |
inp=gr.Textbox(label="Prompt")
|
184 |
+
strength=gr.Slider(label="Strength",minimum=0,maximum=1,step=0.1,value=0.2)
|
185 |
+
guidance=gr.Slider(label="Guidance",minimum=0,maximum=10,step=0.1,value=8.0)
|
186 |
+
infer=gr.Slider(label="Inference Steps",minimum=0,maximum=50,step=1,value=10)
|
187 |
+
|
188 |
with gr.Row():
|
189 |
btn=gr.Button()
|
190 |
+
stop_btn=gr.Button("Stop")
|
191 |
with gr.Column():
|
192 |
inp_im=gr.Image(type='filepath')
|
193 |
im_btn=gr.Button("Image Grid")
|
|
|
199 |
fingal=gr.Gallery(columns=10)
|
200 |
im_list=gr.Textbox()
|
201 |
im_btn.click(load_im,inp_im,[outp,im_list])
|
202 |
+
go_btn = btn.click(run_dif,[inp,outp,model_drop,cnt,strength,guidance,infer],[fingal,out_html])
|
203 |
stop_btn.click(None,None,None,cancels=[go_btn])
|
204 |
app.queue().launch()
|