Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -19,7 +19,8 @@ def mask_to_rgb(mask):
|
|
19 |
bg_transparent[mask == 1] = [0, 255, 0, 127]
|
20 |
return bg_transparent
|
21 |
|
22 |
-
def get_processed_inputs(image,
|
|
|
23 |
input_points = [points]
|
24 |
inputs = processor(image, input_points=input_points, return_tensors="pt").to(device)
|
25 |
with torch.no_grad():
|
@@ -59,7 +60,7 @@ iface = gr.Interface(
|
|
59 |
fn=gradio_interface,
|
60 |
inputs=[
|
61 |
gr.Image(type="numpy", label="Input Image"),
|
62 |
-
gr.
|
63 |
gr.Textbox(label="Positive Prompt", placeholder="Enter positive prompt here"),
|
64 |
gr.Textbox(label="Negative Prompt", placeholder="Enter negative prompt here")
|
65 |
],
|
@@ -68,7 +69,7 @@ iface = gr.Interface(
|
|
68 |
gr.Image(label="Segmentation Mask")
|
69 |
],
|
70 |
title="Interactive Image Inpainting",
|
71 |
-
description="
|
72 |
)
|
73 |
|
74 |
iface.launch(share=True)
|
|
|
19 |
bg_transparent[mask == 1] = [0, 255, 0, 127]
|
20 |
return bg_transparent
|
21 |
|
22 |
+
def get_processed_inputs(image, points_str):
|
23 |
+
points = [list(map(int, point.split(','))) for point in points_str.split()]
|
24 |
input_points = [points]
|
25 |
inputs = processor(image, input_points=input_points, return_tensors="pt").to(device)
|
26 |
with torch.no_grad():
|
|
|
60 |
fn=gradio_interface,
|
61 |
inputs=[
|
62 |
gr.Image(type="numpy", label="Input Image"),
|
63 |
+
gr.Textbox(label="Points (format: x1,y1 x2,y2 ...)", placeholder="e.g., 100,100 200,200"),
|
64 |
gr.Textbox(label="Positive Prompt", placeholder="Enter positive prompt here"),
|
65 |
gr.Textbox(label="Negative Prompt", placeholder="Enter negative prompt here")
|
66 |
],
|
|
|
69 |
gr.Image(label="Segmentation Mask")
|
70 |
],
|
71 |
title="Interactive Image Inpainting",
|
72 |
+
description="Enter points as 'x1,y1 x2,y2 ...' for segmentation, provide prompts, and see the inpainted result."
|
73 |
)
|
74 |
|
75 |
iface.launch(share=True)
|