Spaces:
Runtime error
Runtime error
suppress error when deleting an image
Browse files
app.py
CHANGED
|
@@ -77,6 +77,9 @@ def image_changed(image):
|
|
| 77 |
json = estimate_body(image)
|
| 78 |
return json, image.width, image.height
|
| 79 |
|
|
|
|
|
|
|
|
|
|
| 80 |
html_text = f"""
|
| 81 |
<canvas id="canvas" width="512" height="512"></canvas>
|
| 82 |
<script type="text/javascript" defer>{file_contents}</script>
|
|
@@ -97,6 +100,7 @@ with gr.Blocks() as demo:
|
|
| 97 |
|
| 98 |
source.change(
|
| 99 |
fn = image_changed,
|
|
|
|
| 100 |
inputs = [source],
|
| 101 |
outputs = [json, width, height])
|
| 102 |
startBtn.click(
|
|
|
|
| 77 |
json = estimate_body(image)
|
| 78 |
return json, image.width, image.height
|
| 79 |
|
| 80 |
+
def image_preprocess(image):
|
| 81 |
+
return image is not None
|
| 82 |
+
|
| 83 |
html_text = f"""
|
| 84 |
<canvas id="canvas" width="512" height="512"></canvas>
|
| 85 |
<script type="text/javascript" defer>{file_contents}</script>
|
|
|
|
| 100 |
|
| 101 |
source.change(
|
| 102 |
fn = image_changed,
|
| 103 |
+
preprocess = image_preprocess,
|
| 104 |
inputs = [source],
|
| 105 |
outputs = [json, width, height])
|
| 106 |
startBtn.click(
|