Sandeepa commited on
Commit
65b316e
·
1 Parent(s): fd662e3

PIL image fix

Browse files
Files changed (1) hide show
  1. app.py +7 -2
app.py CHANGED
@@ -3,6 +3,7 @@ from depth_detection import depth_detection
3
  from mesh_network import mesh_network
4
  from point_cloud import point_cloud
5
  from PIL import Image
 
6
 
7
  def reconstruction3d(input_image):
8
 
@@ -11,6 +12,10 @@ def reconstruction3d(input_image):
11
  output_mesh = mesh_network(pcd_img)
12
  return output_mesh
13
 
14
- input_image = gr.inputs.Image(label="Input Image")
15
- iface = gr.Interface(fn=reconstruction3d, inputs=input_image, outputs="image")
 
 
 
 
16
  iface.launch()
 
3
  from mesh_network import mesh_network
4
  from point_cloud import point_cloud
5
  from PIL import Image
6
+ import io
7
 
8
  def reconstruction3d(input_image):
9
 
 
12
  output_mesh = mesh_network(pcd_img)
13
  return output_mesh
14
 
15
+ def image_bytes_to_pil_image(image_bytes):
16
+ image = Image.open(io.BytesIO(image_bytes))
17
+ return image
18
+
19
+ input_image = gr.inputs.BytesIO(label="Input Image")
20
+ iface = gr.Interface(fn=reconstruction3d, inputs=input_image.preprocess(image_bytes_to_pil_image), outputs="image")
21
  iface.launch()