Spaces:
Runtime error
Runtime error
Commit
·
d46ad28
1
Parent(s):
4519f9b
update
Browse files
app.py
CHANGED
@@ -22,10 +22,10 @@ def inference_mask1(prompt,
|
|
22 |
a = json.loads(r.text)
|
23 |
res = []
|
24 |
for i in range(len(a)):
|
25 |
-
out = Image.open(io.BytesIO(base64.b64decode(a[i])))
|
26 |
-
out = out.resize((224, 224))
|
27 |
-
res.append(np.uint8(np.array(out)))
|
28 |
-
|
29 |
return res
|
30 |
|
31 |
def resizeImg(img):
|
@@ -58,7 +58,8 @@ examples = [
|
|
58 |
|
59 |
demo_mask = gr.Interface(fn=inference_mask1,
|
60 |
inputs=[gr.ImageMask(label="prompt (提示图)"), gr.Image(label="img1 (测试图1)"), gr.Image(label="img2 (测试图2)")],
|
61 |
-
outputs=[gr.Image(label="output1 (输出图1)"), gr.Image(label="output2 (输出图2)")],
|
|
|
62 |
#outputs=gr.Gallery(label="outputs (输出图)"),
|
63 |
examples=examples,
|
64 |
#title="SegGPT for Any Segmentation<br>(Painter Inside)",
|
|
|
22 |
a = json.loads(r.text)
|
23 |
res = []
|
24 |
for i in range(len(a)):
|
25 |
+
#out = Image.open(io.BytesIO(base64.b64decode(a[i])))
|
26 |
+
#out = out.resize((224, 224))
|
27 |
+
#res.append(np.uint8(np.array(out)))
|
28 |
+
res.append(np.uint8(np.array(Image.open(io.BytesIO(base64.b64decode(a[i]))))))
|
29 |
return res
|
30 |
|
31 |
def resizeImg(img):
|
|
|
58 |
|
59 |
demo_mask = gr.Interface(fn=inference_mask1,
|
60 |
inputs=[gr.ImageMask(label="prompt (提示图)"), gr.Image(label="img1 (测试图1)"), gr.Image(label="img2 (测试图2)")],
|
61 |
+
outputs=[gr.Image(label="output1 (输出图1)", shape=(448, 448)), gr.Image(label="output2 (输出图2)"), shape=(448, 448)],
|
62 |
+
#outputs=[gr.Image(label="output1 (输出图1)"), gr.Image(label="output2 (输出图2)")],
|
63 |
#outputs=gr.Gallery(label="outputs (输出图)"),
|
64 |
examples=examples,
|
65 |
#title="SegGPT for Any Segmentation<br>(Painter Inside)",
|