Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -3,9 +3,7 @@ import gradio as gr
|
|
| 3 |
from PIL import Image
|
| 4 |
from transparent_background import Remover
|
| 5 |
import numpy as np
|
| 6 |
-
import torch
|
| 7 |
|
| 8 |
-
torch.jit.script = lambda f: f
|
| 9 |
# Initialize the model globally
|
| 10 |
remover = Remover(jit=False)
|
| 11 |
|
|
@@ -27,6 +25,12 @@ def process_image(input_image, output_type):
|
|
| 27 |
# Process the image and return the RGBA result
|
| 28 |
output = remover.process(input_image, type='rgba')
|
| 29 |
return output
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 30 |
|
| 31 |
iface = gr.Interface(
|
| 32 |
fn=process_image,
|
|
@@ -35,8 +39,7 @@ iface = gr.Interface(
|
|
| 35 |
gr.Radio(["Default", "Mask only"], label="Output Type", value="Default")
|
| 36 |
],
|
| 37 |
outputs=gr.Image(type="pil", label="Output Image"),
|
| 38 |
-
|
| 39 |
-
description="Remove the background from an image using Inspyrenet. Choose 'Mask only' for a black and white mask, or 'Default' for the image with transparent background.",
|
| 40 |
theme='bethecloud/storj_theme',
|
| 41 |
)
|
| 42 |
|
|
|
|
| 3 |
from PIL import Image
|
| 4 |
from transparent_background import Remover
|
| 5 |
import numpy as np
|
|
|
|
| 6 |
|
|
|
|
| 7 |
# Initialize the model globally
|
| 8 |
remover = Remover(jit=False)
|
| 9 |
|
|
|
|
| 25 |
# Process the image and return the RGBA result
|
| 26 |
output = remover.process(input_image, type='rgba')
|
| 27 |
return output
|
| 28 |
+
|
| 29 |
+
description = """<h1 align="center">InSPyReNet Background Remover</h1>
|
| 30 |
+
<p><center>
|
| 31 |
+
<a href="https://github.com/plemeri/InSPyReNet" target="_blank">[Github]</a>
|
| 32 |
+
</center></p>
|
| 33 |
+
"""
|
| 34 |
|
| 35 |
iface = gr.Interface(
|
| 36 |
fn=process_image,
|
|
|
|
| 39 |
gr.Radio(["Default", "Mask only"], label="Output Type", value="Default")
|
| 40 |
],
|
| 41 |
outputs=gr.Image(type="pil", label="Output Image"),
|
| 42 |
+
description=description,
|
|
|
|
| 43 |
theme='bethecloud/storj_theme',
|
| 44 |
)
|
| 45 |
|