Spaces:
Running
on
Zero
Running
on
Zero
add warning message
Browse files
app.py
CHANGED
@@ -37,6 +37,16 @@ def gradio_inference(
|
|
37 |
height=1024
|
38 |
):
|
39 |
"""Wrapper function for Gradio interface"""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
40 |
# Use temporary directory
|
41 |
with tempfile.TemporaryDirectory() as tmp_dir:
|
42 |
# Save inputs to temp directory
|
@@ -86,6 +96,14 @@ with gr.Blocks() as demo:
|
|
86 |
# gr.Video("example/github.mp4", label="Demo Video: How to use the tool")
|
87 |
|
88 |
with gr.Column():
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
89 |
with gr.Row():
|
90 |
with gr.Column():
|
91 |
image_input = gr.ImageMask(
|
|
|
37 |
height=1024
|
38 |
):
|
39 |
"""Wrapper function for Gradio interface"""
|
40 |
+
# Check if mask has been drawn
|
41 |
+
if image_data is None or "layers" not in image_data or not image_data["layers"]:
|
42 |
+
raise gr.Error("Please draw a mask over the clothing area before generating!")
|
43 |
+
|
44 |
+
# Check if mask is empty (all black)
|
45 |
+
mask = image_data["layers"][0]
|
46 |
+
mask_array = np.array(mask)
|
47 |
+
if np.all(mask_array < 10):
|
48 |
+
raise gr.Error("The mask is empty! Please draw over the clothing area you want to replace.")
|
49 |
+
|
50 |
# Use temporary directory
|
51 |
with tempfile.TemporaryDirectory() as tmp_dir:
|
52 |
# Save inputs to temp directory
|
|
|
96 |
# gr.Video("example/github.mp4", label="Demo Video: How to use the tool")
|
97 |
|
98 |
with gr.Column():
|
99 |
+
gr.Markdown("""
|
100 |
+
### ⚠️ Important:
|
101 |
+
1. Click 'Edit' on the Model Image
|
102 |
+
2. Draw a mask over the clothing area you want to replace
|
103 |
+
3. Click 'Save' when done
|
104 |
+
4. Then click 'Generate Try-On'
|
105 |
+
""")
|
106 |
+
|
107 |
with gr.Row():
|
108 |
with gr.Column():
|
109 |
image_input = gr.ImageMask(
|