Spaces:
Running
on
Zero
Running
on
Zero
Commit
·
36cd713
1
Parent(s):
3afe89d
debugging app.py
Browse files
app.py
CHANGED
|
@@ -13,14 +13,14 @@ import os
|
|
| 13 |
|
| 14 |
|
| 15 |
@spaces.GPU
|
| 16 |
-
def process_image_and_text(image, text,
|
| 17 |
set_seed(seed)
|
| 18 |
# image = Image.open(img_path).convert('RGB')
|
| 19 |
image = resize_and_add_margin(image, target_size=512)
|
| 20 |
|
| 21 |
image_list = [image]
|
| 22 |
|
| 23 |
-
out =
|
| 24 |
prompt=text,
|
| 25 |
height=512,
|
| 26 |
width=512,
|
|
@@ -176,10 +176,11 @@ def create_app(
|
|
| 176 |
inputs=[original_image, text],
|
| 177 |
label="Examples",
|
| 178 |
)
|
| 179 |
-
|
|
|
|
| 180 |
submit_btn.click(
|
| 181 |
-
fn=process_image_and_text,
|
| 182 |
-
inputs=[original_image, text,
|
| 183 |
outputs=output_image,
|
| 184 |
)
|
| 185 |
|
|
|
|
| 13 |
|
| 14 |
|
| 15 |
@spaces.GPU
|
| 16 |
+
def process_image_and_text(image, text, seed, pipeline):
|
| 17 |
set_seed(seed)
|
| 18 |
# image = Image.open(img_path).convert('RGB')
|
| 19 |
image = resize_and_add_margin(image, target_size=512)
|
| 20 |
|
| 21 |
image_list = [image]
|
| 22 |
|
| 23 |
+
out = pipeline(
|
| 24 |
prompt=text,
|
| 25 |
height=512,
|
| 26 |
width=512,
|
|
|
|
| 176 |
inputs=[original_image, text],
|
| 177 |
label="Examples",
|
| 178 |
)
|
| 179 |
+
|
| 180 |
+
from functools import partial
|
| 181 |
submit_btn.click(
|
| 182 |
+
fn=partial(process_image_and_text, pipeline=pipe),
|
| 183 |
+
inputs=[original_image, text, seed],
|
| 184 |
outputs=output_image,
|
| 185 |
)
|
| 186 |
|