Spaces:
Runtime error
Runtime error
Jagrut Thakare
commited on
Commit
·
d2700a6
1
Parent(s):
f47575c
v1.6
Browse files- app.py +12 -11
- src/core.py → core.py +1 -1
- src/helper.py → helper.py +0 -0
- src/__init__.py +0 -0
app.py
CHANGED
|
@@ -3,7 +3,7 @@ import gradio as gr
|
|
| 3 |
from PIL import Image
|
| 4 |
from io import BytesIO
|
| 5 |
from copy import deepcopy
|
| 6 |
-
from
|
| 7 |
from huggingface_hub import login
|
| 8 |
import os
|
| 9 |
import spaces
|
|
@@ -15,14 +15,15 @@ def process_image(image):
|
|
| 15 |
img_output = Image.fromarray(output).convert("RGB")
|
| 16 |
return img_output
|
| 17 |
|
| 18 |
-
demo = gr.Interface(
|
| 19 |
-
fn=process_image,
|
| 20 |
-
inputs=[
|
| 21 |
-
gr.ImageMask(type="numpy", layers=False, label="Upload Image"),
|
| 22 |
-
],
|
| 23 |
-
outputs=gr.Image(format="png", label="Output Image"),
|
| 24 |
-
title="Object Remover",
|
| 25 |
-
)
|
| 26 |
|
| 27 |
-
|
| 28 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
from PIL import Image
|
| 4 |
from io import BytesIO
|
| 5 |
from copy import deepcopy
|
| 6 |
+
from core import process_inpaint
|
| 7 |
from huggingface_hub import login
|
| 8 |
import os
|
| 9 |
import spaces
|
|
|
|
| 15 |
img_output = Image.fromarray(output).convert("RGB")
|
| 16 |
return img_output
|
| 17 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
|
| 19 |
+
with gr.Blocks() as demo:
|
| 20 |
+
gr.Markdown("# OBJECT REMOVER")
|
| 21 |
+
with gr.Row():
|
| 22 |
+
with gr.Column():
|
| 23 |
+
image = gr.ImageMask(type="numpy", layers=False, label="Upload Image")
|
| 24 |
+
button = gr.Button("Remove")
|
| 25 |
+
with gr.Column():
|
| 26 |
+
output = gr.Image(format="png", label="Output Image")
|
| 27 |
+
button.click(process_image, inputs=[image], outputs=[output])
|
| 28 |
+
|
| 29 |
+
demo.launch()
|
src/core.py → core.py
RENAMED
|
@@ -20,7 +20,7 @@ from typing import Union
|
|
| 20 |
|
| 21 |
import torch
|
| 22 |
|
| 23 |
-
from
|
| 24 |
download_model,
|
| 25 |
load_img,
|
| 26 |
norm_img,
|
|
|
|
| 20 |
|
| 21 |
import torch
|
| 22 |
|
| 23 |
+
from helper import (
|
| 24 |
download_model,
|
| 25 |
load_img,
|
| 26 |
norm_img,
|
src/helper.py → helper.py
RENAMED
|
File without changes
|
src/__init__.py
DELETED
|
File without changes
|