Spaces:
Running
on
Zero
Running
on
Zero
gokaygokay
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -5,15 +5,11 @@ from transparent_background import Remover
|
|
5 |
import numpy as np
|
6 |
|
7 |
# Initialize the model globally
|
8 |
-
remover = Remover()
|
9 |
|
10 |
@spaces.GPU
|
11 |
-
def process_image(input_image,
|
12 |
global remover
|
13 |
-
if torchscript_jit == "on" and not isinstance(remover, Remover(jit=True).__class__):
|
14 |
-
remover = Remover(jit=True)
|
15 |
-
elif torchscript_jit == "default" and not isinstance(remover, Remover().__class__):
|
16 |
-
remover = Remover()
|
17 |
|
18 |
if output_type == "Mask only":
|
19 |
# Process the image and get only the mask
|
@@ -34,7 +30,6 @@ iface = gr.Interface(
|
|
34 |
fn=process_image,
|
35 |
inputs=[
|
36 |
gr.Image(type="pil", label="Input Image"),
|
37 |
-
gr.Radio(["default", "on"], label="TorchScript JIT", value="on"),
|
38 |
gr.Radio(["Default", "Mask only"], label="Output Type", value="Default")
|
39 |
],
|
40 |
outputs=gr.Image(type="pil", label="Output Image"),
|
|
|
5 |
import numpy as np
|
6 |
|
7 |
# Initialize the model globally
|
8 |
+
remover = Remover(jit=False)
|
9 |
|
10 |
@spaces.GPU
|
11 |
+
def process_image(input_image, output_type):
|
12 |
global remover
|
|
|
|
|
|
|
|
|
13 |
|
14 |
if output_type == "Mask only":
|
15 |
# Process the image and get only the mask
|
|
|
30 |
fn=process_image,
|
31 |
inputs=[
|
32 |
gr.Image(type="pil", label="Input Image"),
|
|
|
33 |
gr.Radio(["Default", "Mask only"], label="Output Type", value="Default")
|
34 |
],
|
35 |
outputs=gr.Image(type="pil", label="Output Image"),
|