Update app.py
Browse files
app.py
CHANGED
@@ -1,8 +1,14 @@
|
|
1 |
import gradio as gr
|
|
|
2 |
import numpy as np
|
|
|
3 |
|
4 |
def display_sketch(sketch):
|
5 |
-
#
|
|
|
|
|
|
|
|
|
6 |
return sketch
|
7 |
|
8 |
with gr.Blocks() as demo:
|
@@ -11,4 +17,4 @@ with gr.Blocks() as demo:
|
|
11 |
|
12 |
sketchpad.change(display_sketch, inputs=sketchpad, outputs=output_image)
|
13 |
|
14 |
-
demo.launch(
|
|
|
1 |
import gradio as gr
|
2 |
+
from PIL import Image
|
3 |
import numpy as np
|
4 |
+
import io
|
5 |
|
6 |
def display_sketch(sketch):
|
7 |
+
# Ensure the sketch is a numpy array
|
8 |
+
if isinstance(sketch, dict):
|
9 |
+
sketch = sketch["image"]
|
10 |
+
if not isinstance(sketch, np.ndarray):
|
11 |
+
raise ValueError("The sketch input is not a valid numpy array")
|
12 |
return sketch
|
13 |
|
14 |
with gr.Blocks() as demo:
|
|
|
17 |
|
18 |
sketchpad.change(display_sketch, inputs=sketchpad, outputs=output_image)
|
19 |
|
20 |
+
demo.launch()
|