Update app.py
Browse files
app.py
CHANGED
@@ -37,10 +37,12 @@ def fn(image):
|
|
37 |
pred_pil = transforms.ToPILImage()(pred)
|
38 |
mask = pred_pil.resize(image_size)
|
39 |
image.putalpha(mask)
|
40 |
-
return (image, origin)
|
|
|
41 |
|
42 |
|
43 |
-
slider1 = ImageSlider(label="birefnet", type="pil")
|
|
|
44 |
slider2 = ImageSlider(label="birefnet", type="pil")
|
45 |
image = gr.Image(label="Upload an image")
|
46 |
text = gr.Textbox(label="Paste an image URL")
|
@@ -50,7 +52,7 @@ chameleon = load_img("chameleon.jpg", output_type="pil")
|
|
50 |
|
51 |
url = "https://hips.hearstapps.com/hmg-prod/images/gettyimages-1229892983-square.jpg"
|
52 |
tab1 = gr.Interface(
|
53 |
-
fn, inputs=image, outputs=
|
54 |
)
|
55 |
|
56 |
tab2 = gr.Interface(fn, inputs=text, outputs=slider2, examples=[url], api_name="text")
|
|
|
37 |
pred_pil = transforms.ToPILImage()(pred)
|
38 |
mask = pred_pil.resize(image_size)
|
39 |
image.putalpha(mask)
|
40 |
+
# return (image, origin)
|
41 |
+
return image
|
42 |
|
43 |
|
44 |
+
# slider1 = ImageSlider(label="birefnet", type="pil")
|
45 |
+
img1 = gr.Image(type= "pil", image_mode="RGBA")
|
46 |
slider2 = ImageSlider(label="birefnet", type="pil")
|
47 |
image = gr.Image(label="Upload an image")
|
48 |
text = gr.Textbox(label="Paste an image URL")
|
|
|
52 |
|
53 |
url = "https://hips.hearstapps.com/hmg-prod/images/gettyimages-1229892983-square.jpg"
|
54 |
tab1 = gr.Interface(
|
55 |
+
fn, inputs=image, outputs=img1, examples=[chameleon], api_name="image"
|
56 |
)
|
57 |
|
58 |
tab2 = gr.Interface(fn, inputs=text, outputs=slider2, examples=[url], api_name="text")
|