Spaces:
Configuration error
Configuration error
Add simple gradio to create image masks
Browse files- README.md +0 -0
- app.py +22 -0
- masquerade/__init__.py +0 -0
- poetry.lock +0 -0
- pyproject.toml +19 -0
- tests/__init__.py +0 -0
README.md
ADDED
File without changes
|
app.py
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
|
3 |
+
|
4 |
+
def draw_mask(args):
|
5 |
+
init_image = args.get("image")
|
6 |
+
mask = args.get("mask")
|
7 |
+
mask = mask.convert("RGB").resize((512, 512))
|
8 |
+
init_image = init_image.convert("RGB").resize((512, 512))
|
9 |
+
return mask
|
10 |
+
|
11 |
+
|
12 |
+
gr.Interface(
|
13 |
+
fn=draw_mask,
|
14 |
+
inputs=gr.Image(
|
15 |
+
source="upload",
|
16 |
+
tool="sketch",
|
17 |
+
elem_id="image_upload",
|
18 |
+
type="pil",
|
19 |
+
label="Upload",
|
20 |
+
).style(height=400),
|
21 |
+
outputs=gr.Image(label="Result"),
|
22 |
+
).launch()
|
masquerade/__init__.py
ADDED
File without changes
|
poetry.lock
ADDED
The diff for this file is too large to render.
See raw diff
|
|
pyproject.toml
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
[tool.poetry]
|
2 |
+
name = "masquerade"
|
3 |
+
version = "0.1.0"
|
4 |
+
description = ""
|
5 |
+
authors = ["David Lundgren <david.m.lundgren@gmail.com>"]
|
6 |
+
readme = "README.md"
|
7 |
+
|
8 |
+
[tool.poetry.dependencies]
|
9 |
+
python = "^3.11"
|
10 |
+
gradio = "^3.22.1"
|
11 |
+
torch = "^2.0.0"
|
12 |
+
|
13 |
+
|
14 |
+
[tool.poetry.group.dev.dependencies]
|
15 |
+
black = "^23.1.0"
|
16 |
+
|
17 |
+
[build-system]
|
18 |
+
requires = ["poetry-core"]
|
19 |
+
build-backend = "poetry.core.masonry.api"
|
tests/__init__.py
ADDED
File without changes
|