Jangai commited on
Commit
5cac164
·
verified ·
1 Parent(s): 258bc81

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -2
app.py CHANGED
@@ -1,8 +1,14 @@
1
  import gradio as gr
 
2
  import numpy as np
 
3
 
4
  def display_sketch(sketch):
5
- # Directly return the sketch as it is already an image
 
 
 
 
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(share=True)
 
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()