ysharma HF staff commited on
Commit
b8d115d
·
1 Parent(s): f1f4a2c
Files changed (1) hide show
  1. gradio_seg2image.py +7 -4
gradio_seg2image.py CHANGED
@@ -3,20 +3,23 @@
3
  import gradio as gr
4
  from PIL import Image
5
 
 
 
 
6
  def dummyfun(result_gallery):
7
  print(f"type of gallery is ^^ - {type(result_gallery)}")
8
  print(f"length of gallery is ^^ - {len(result_gallery)}")
9
  print(f"first elem of gallery is ^^ - {result_gallery[0]}")
10
  print(f"first elem of gallery is ^^ - {result_gallery[1]}")
11
  # Load the image
12
- image = result_gallery[1] #Image.open("example.jpg")
13
 
14
  # Get the filename
15
- filename = image.filename
16
 
17
  # Print the filename
18
- print(f"filename is ^^ - {filename}")
19
- return filename
20
 
21
  def create_demo(process, max_images=12):
22
  with gr.Blocks() as demo:
 
3
  import gradio as gr
4
  from PIL import Image
5
 
6
+ #first elem of gallery is ^^ - {'name': '/tmp/tmpw60bbw6k.png', 'data': 'file=/tmp/tmpw60bbw6k.png', 'is_file': True}
7
+ #first elem of gallery is ^^ - {'name': '/tmp/tmpba0d5dt5.png', 'data': 'file=/tmp/tmpba0d5dt5.png', 'is_file': True}
8
+
9
  def dummyfun(result_gallery):
10
  print(f"type of gallery is ^^ - {type(result_gallery)}")
11
  print(f"length of gallery is ^^ - {len(result_gallery)}")
12
  print(f"first elem of gallery is ^^ - {result_gallery[0]}")
13
  print(f"first elem of gallery is ^^ - {result_gallery[1]}")
14
  # Load the image
15
+ #image = result_gallery[1] #Image.open("example.jpg")
16
 
17
  # Get the filename
18
+ #filename = image.filename
19
 
20
  # Print the filename
21
+ #print(f"filename is ^^ - {filename}")
22
+ return result_gallery[0]['name'] + ',' + result_gallery[1]['name'] #filename
23
 
24
  def create_demo(process, max_images=12):
25
  with gr.Blocks() as demo: