Omnibus commited on
Commit
92bfde1
·
verified ·
1 Parent(s): 6154d12

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -4,7 +4,8 @@ from PIL import Image
4
  # PIL accesses images in Cartesian co-ordinates, so it is Image[columns, rows]
5
  #img = Image.new( 'RGB', (250,250), (0,0,0)) # create a new black image
6
  #pixels = img.load() # create the pixel map
7
- def get_pixels(img):
 
8
  pixels = img.load() # create the pixel map
9
 
10
  pixel_box=[]
@@ -17,7 +18,7 @@ def get_pixels(img):
17
 
18
  return pixel_box
19
  with gr.Blocks() as app:
20
- in_im=gr.Image()
21
  go_btn=gr.Button()
22
  out_json=gr.JSON()
23
  go_btn.click(get_pixels,in_im,out_json)
 
4
  # PIL accesses images in Cartesian co-ordinates, so it is Image[columns, rows]
5
  #img = Image.new( 'RGB', (250,250), (0,0,0)) # create a new black image
6
  #pixels = img.load() # create the pixel map
7
+ def get_pixels(im):
8
+ img=Image.open(im)
9
  pixels = img.load() # create the pixel map
10
 
11
  pixel_box=[]
 
18
 
19
  return pixel_box
20
  with gr.Blocks() as app:
21
+ in_im=gr.Image(type='filepath')
22
  go_btn=gr.Button()
23
  out_json=gr.JSON()
24
  go_btn.click(get_pixels,in_im,out_json)