Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -27,17 +27,20 @@ def load_model(model_drop):
|
|
27 |
|
28 |
def run_dif(prompt,im_path,model_drop,cnt):
|
29 |
out_box=[]
|
30 |
-
url = base_url+im_path
|
31 |
-
init_image = load_image(url)
|
32 |
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
|
|
|
|
|
|
|
|
|
|
41 |
|
42 |
|
43 |
|
@@ -171,16 +174,20 @@ with gr.Blocks(css=css) as app:
|
|
171 |
with gr.Row():
|
172 |
with gr.Column():
|
173 |
inp=gr.Textbox(label="Prompt")
|
174 |
-
|
|
|
|
|
175 |
with gr.Column():
|
176 |
inp_im=gr.Image(type='filepath')
|
177 |
-
im_btn=gr.Button()
|
178 |
with gr.Row():
|
179 |
model_drop=gr.Dropdown(label="Models", choices=models, type='index', value=models[0])
|
180 |
cnt = gr.Number(value=1)
|
181 |
out_html=gr.HTML()
|
182 |
outp=gr.Gallery(columns=10)
|
183 |
-
|
|
|
184 |
im_btn.click(load_im,inp_im,outp)
|
185 |
-
btn.click(run_dif,[inp,
|
|
|
186 |
app.launch()
|
|
|
27 |
|
28 |
def run_dif(prompt,im_path,model_drop,cnt):
|
29 |
out_box=[]
|
|
|
|
|
30 |
|
31 |
+
for ea in im_path:
|
32 |
+
print(ea)
|
33 |
+
url = base_url+ea
|
34 |
+
init_image = load_image(url)
|
35 |
+
|
36 |
+
#prompt = "Astronaut in a jungle, cold color palette, muted colors, detailed, 8k"
|
37 |
+
|
38 |
+
# pass prompt and image to pipeline
|
39 |
+
#image = pipeline(prompt, image=init_image, strength=0.8,guidance_scale=8.0,negative_prompt=negative_prompt,num_inference_steps=50).images[0]
|
40 |
+
image = pipeline(prompt, image=init_image, strength=0.2,guidance_scale=8.0,num_inference_steps=2).images[0]
|
41 |
+
#make_image_grid([init_image, image], rows=1, cols=2)
|
42 |
+
out_box.append(image)
|
43 |
+
yield out_box,""
|
44 |
|
45 |
|
46 |
|
|
|
174 |
with gr.Row():
|
175 |
with gr.Column():
|
176 |
inp=gr.Textbox(label="Prompt")
|
177 |
+
with gr.Row():
|
178 |
+
btn=gr.Button()
|
179 |
+
stop_btn=gr.Button()
|
180 |
with gr.Column():
|
181 |
inp_im=gr.Image(type='filepath')
|
182 |
+
im_btn=gr.Button("Image Grid")
|
183 |
with gr.Row():
|
184 |
model_drop=gr.Dropdown(label="Models", choices=models, type='index', value=models[0])
|
185 |
cnt = gr.Number(value=1)
|
186 |
out_html=gr.HTML()
|
187 |
outp=gr.Gallery(columns=10)
|
188 |
+
fingal=gr.Gallery(columns=10)
|
189 |
+
|
190 |
im_btn.click(load_im,inp_im,outp)
|
191 |
+
go_btn = btn.click(run_dif,[inp,outp,model_drop,cnt],[fingal,out_html])
|
192 |
+
stop_btn.click(None,None,None,cancels='go_btn')
|
193 |
app.launch()
|