Spaces:
Sleeping
Sleeping
Commit
·
8a5a456
1
Parent(s):
5103476
up 1
Browse files
app.py
CHANGED
|
@@ -19,7 +19,8 @@ def image_to_byte_array(image: Image) -> bytes:
|
|
| 19 |
def predict(input_img1,
|
| 20 |
input_img2,
|
| 21 |
positive_prompt,
|
| 22 |
-
negative_prompt
|
|
|
|
| 23 |
):
|
| 24 |
|
| 25 |
print("predict")
|
|
@@ -32,14 +33,14 @@ def predict(input_img1,
|
|
| 32 |
canvas_mask = np.array(input_img2)
|
| 33 |
mask = get_mask(canvas_mask)
|
| 34 |
|
| 35 |
-
print(input_img1, mask,positive_prompt,negative_prompt)
|
| 36 |
|
| 37 |
retList=[]
|
| 38 |
-
for x in range(
|
| 39 |
-
result_image = make_inpainting(positive_prompt=
|
| 40 |
image=input_img1,
|
| 41 |
mask_image=mask,
|
| 42 |
-
negative_prompt=
|
| 43 |
)
|
| 44 |
retList.append(result_image)
|
| 45 |
|
|
@@ -49,7 +50,10 @@ def predict(input_img1,
|
|
| 49 |
app = gr.Interface(
|
| 50 |
predict,
|
| 51 |
inputs=[gr.Image(label="img", sources=['upload'], type="pil"),
|
| 52 |
-
gr.Image(label="mask", sources=['upload'], type="pil")
|
|
|
|
|
|
|
|
|
|
| 53 |
],
|
| 54 |
outputs= [
|
| 55 |
gr.Image(label="resp0"),
|
|
@@ -68,8 +72,7 @@ app = gr.Interface(
|
|
| 68 |
app.launch(share=True)
|
| 69 |
|
| 70 |
#
|
| 71 |
-
|
| 72 |
-
# gr.Textbox(label="negative_prompt")
|
| 73 |
|
| 74 |
# gr.Interface(
|
| 75 |
# test1,
|
|
|
|
| 19 |
def predict(input_img1,
|
| 20 |
input_img2,
|
| 21 |
positive_prompt,
|
| 22 |
+
negative_prompt,
|
| 23 |
+
num_of_images
|
| 24 |
):
|
| 25 |
|
| 26 |
print("predict")
|
|
|
|
| 33 |
canvas_mask = np.array(input_img2)
|
| 34 |
mask = get_mask(canvas_mask)
|
| 35 |
|
| 36 |
+
print(input_img1, mask, positive_prompt, negative_prompt)
|
| 37 |
|
| 38 |
retList=[]
|
| 39 |
+
for x in range(num_of_images):
|
| 40 |
+
result_image = make_inpainting(positive_prompt=positive_prompt,
|
| 41 |
image=input_img1,
|
| 42 |
mask_image=mask,
|
| 43 |
+
negative_prompt=negative_prompt,
|
| 44 |
)
|
| 45 |
retList.append(result_image)
|
| 46 |
|
|
|
|
| 50 |
app = gr.Interface(
|
| 51 |
predict,
|
| 52 |
inputs=[gr.Image(label="img", sources=['upload'], type="pil"),
|
| 53 |
+
gr.Image(label="mask", sources=['upload'], type="pil"),
|
| 54 |
+
gr.Textbox(label="positive_prompt"),
|
| 55 |
+
gr.Textbox(label="negative_prompt"),
|
| 56 |
+
gr.Number(label="num_of_images")
|
| 57 |
],
|
| 58 |
outputs= [
|
| 59 |
gr.Image(label="resp0"),
|
|
|
|
| 72 |
app.launch(share=True)
|
| 73 |
|
| 74 |
#
|
| 75 |
+
|
|
|
|
| 76 |
|
| 77 |
# gr.Interface(
|
| 78 |
# test1,
|