Spaces:
Runtime error
Runtime error
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# -*- coding: utf-8 -*-
|
| 2 |
+
"""Olá, este é o Colaboratory
|
| 3 |
+
|
| 4 |
+
Automatically generated by Colab.
|
| 5 |
+
|
| 6 |
+
Original file is located at
|
| 7 |
+
https://colab.research.google.com/github/renato186a1/Renato186/blob/main/remove_backgroung_image.ipynb
|
| 8 |
+
"""
|
| 9 |
+
|
| 10 |
+
# prompt: create interface for remove background images + gradio
|
| 11 |
+
|
| 12 |
+
!pip install -q gradio rembg
|
| 13 |
+
|
| 14 |
+
import gradio as gr
|
| 15 |
+
from rembg import remove
|
| 16 |
+
|
| 17 |
+
def remove_background(image):
|
| 18 |
+
output = remove(image)
|
| 19 |
+
return output
|
| 20 |
+
|
| 21 |
+
iface = gr.Interface(
|
| 22 |
+
fn=remove_background,
|
| 23 |
+
inputs=gr.Image(type="pil"),
|
| 24 |
+
outputs=gr.Image(type="pil"),
|
| 25 |
+
title="Remove Background from Image",
|
| 26 |
+
description="Upload an image and this tool will remove its background.",
|
| 27 |
+
)
|
| 28 |
+
|
| 29 |
+
iface.launch()
|