dhanushreddy29 commited on
Commit
2930bea
·
1 Parent(s): 837f8d3

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +2 -4
main.py CHANGED
@@ -12,13 +12,11 @@ def remove_background(input_image):
12
  inputs = gr.inputs.Image()
13
  outputs = gr.outputs.Image(type='pil')
14
 
15
- gr.Interface(fn=remove_background, inputs=inputs, outputs=outputs).launch()
 
16
 
17
  @app.route("/api/remove-background", methods=["POST"])
18
  def remove_background_api():
19
- if request.method == "GET":
20
- return "This API removes the background from an image. To use it, send a POST request to this URL with an image file in the 'input' field of the request body."
21
-
22
  input_image = Image.open(request.files["input"])
23
  output_image = remove_background(input_image)
24
  return jsonify({"output": output_image})
 
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
  @app.route("/api/remove-background", methods=["POST"])
19
  def remove_background_api():
 
 
 
20
  input_image = Image.open(request.files["input"])
21
  output_image = remove_background(input_image)
22
  return jsonify({"output": output_image})