dhanushreddy29
commited on
Commit
·
54c613b
1
Parent(s):
f0b4848
Update main.py
Browse files
main.py
CHANGED
@@ -1,33 +1,26 @@
|
|
1 |
import gradio as gr
|
2 |
from rembg import remove
|
3 |
from PIL import Image
|
4 |
-
from flask import Flask, request, jsonify
|
5 |
|
6 |
-
app = Flask(__name__)
|
7 |
|
8 |
def remove_background(input_image):
|
9 |
output_image = remove(input_image)
|
10 |
return output_image
|
11 |
|
12 |
-
inputs = gr.inputs.Image()
|
13 |
-
outputs = gr.outputs.Image(type='pil')
|
14 |
-
|
15 |
-
interface = gr.Interface(fn=remove_background, inputs=inputs, outputs=outputs, title="Remove Background", description="This App removes the background from an image.", api="flask")
|
16 |
-
interface.launch()
|
17 |
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
|
|
1 |
import gradio as gr
|
2 |
from rembg import remove
|
3 |
from PIL import Image
|
|
|
4 |
|
|
|
5 |
|
6 |
def remove_background(input_image):
|
7 |
output_image = remove(input_image)
|
8 |
return output_image
|
9 |
|
|
|
|
|
|
|
|
|
|
|
10 |
|
11 |
+
inputs = gr.inputs.Image()
|
12 |
+
outputs = gr.outputs.Image(type="pil")
|
13 |
+
interface = gr.Interface(
|
14 |
+
fn=remove_background,
|
15 |
+
inputs=inputs,
|
16 |
+
outputs=outputs,
|
17 |
+
title="Remove Background",
|
18 |
+
description="This App removes the background from an image",
|
19 |
+
examples=[
|
20 |
+
"examples/input/1.jpeg",
|
21 |
+
"examples/input/2.jpeg",
|
22 |
+
"examples/input/3.jpeg",
|
23 |
+
],
|
24 |
+
cache_examples=True,
|
25 |
+
)
|
26 |
+
interface.launch(enable_queue=True)
|