Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -231,21 +231,22 @@ def process_prompt(img: Image.Image, prompt: str, bg_prompt: str | None = None)
|
|
| 231 |
raise gr.Error(str(e))
|
| 232 |
|
| 233 |
|
|
|
|
| 234 |
def update_process_button(img, prompt):
|
| 235 |
-
return gr.
|
| 236 |
interactive=bool(img and prompt),
|
| 237 |
variant="primary" if bool(img and prompt) else "secondary"
|
| 238 |
)
|
| 239 |
-
|
| 240 |
def update_box_button(img, box_input):
|
| 241 |
try:
|
| 242 |
if img and box_input:
|
| 243 |
coords = eval(box_input)
|
| 244 |
if isinstance(coords, list) and len(coords) == 4:
|
| 245 |
-
return gr.
|
| 246 |
-
return gr.
|
| 247 |
except:
|
| 248 |
-
return gr.
|
| 249 |
|
| 250 |
|
| 251 |
# ๋งจ ์๋ถ๋ถ์ CSS ์ ์ ์ถ๊ฐ
|
|
|
|
| 231 |
raise gr.Error(str(e))
|
| 232 |
|
| 233 |
|
| 234 |
+
# Event handler functions ์์
|
| 235 |
def update_process_button(img, prompt):
|
| 236 |
+
return gr.update(
|
| 237 |
interactive=bool(img and prompt),
|
| 238 |
variant="primary" if bool(img and prompt) else "secondary"
|
| 239 |
)
|
| 240 |
+
|
| 241 |
def update_box_button(img, box_input):
|
| 242 |
try:
|
| 243 |
if img and box_input:
|
| 244 |
coords = eval(box_input)
|
| 245 |
if isinstance(coords, list) and len(coords) == 4:
|
| 246 |
+
return gr.update(interactive=True, variant="primary")
|
| 247 |
+
return gr.update(interactive=False, variant="secondary")
|
| 248 |
except:
|
| 249 |
+
return gr.update(interactive=False, variant="secondary")
|
| 250 |
|
| 251 |
|
| 252 |
# ๋งจ ์๋ถ๋ถ์ CSS ์ ์ ์ถ๊ฐ
|