ysharma HF staff commited on
Commit
6156168
·
1 Parent(s): 2df6a62
Files changed (1) hide show
  1. gradio_seg2image.py +6 -5
gradio_seg2image.py CHANGED
@@ -28,6 +28,7 @@ def encode(img_array):
28
 
29
  def create_imgcomp(input_image, filename):
30
  encoded_string = encode(input_image)
 
31
  htmltag = '<img src= "data:image/jpeg;base64,' + encoded_string + '" alt="Original Image"/></div> <img src= "https://ysharma-controlnet-image-comparison.hf.space/file=' + filename + '" alt="Control Net Image"/>'
32
  #https://ysharma-controlnetsegmentation.hf.space/file=/tmp/tmpqcz9yeta.png
33
  #https://ysharma-controlnet-image-comparison.hf.space/file=/tmp/tmpg4qx22xy.png
@@ -154,12 +155,12 @@ def create_demo(process, max_images=12):
154
  'longbody, lowres, bad anatomy, bad hands, missing fingers, extra digit, fewer digits, cropped, worst quality, low quality'
155
  )
156
  with gr.Column():
157
- result_gallery = gr.Gallery(label='Output', #visible= False,
158
  show_label=False,
159
  elem_id='gallery').style(
160
  grid=2, height='auto')
161
  b1 = gr.Button('Get filenames')
162
- filename = gr.Textbox(label="image file names")
163
  b2 = gr.Button('Show Image-Comparison')
164
  imagecomp = gr.HTML()
165
  ips = [
@@ -168,9 +169,9 @@ def create_demo(process, max_images=12):
168
  ]
169
  run_button.click(fn=process,
170
  inputs=ips,
171
- outputs=[result_gallery],
172
  api_name='seg')
173
- b1.click(dummyfun, [result_gallery], [filename])
174
- b2.click(create_imgcomp, [input_image, filename], [imagecomp])
175
 
176
  return demo
 
28
 
29
  def create_imgcomp(input_image, filename):
30
  encoded_string = encode(input_image)
31
+ #dummyfun(result_gallery)
32
  htmltag = '<img src= "data:image/jpeg;base64,' + encoded_string + '" alt="Original Image"/></div> <img src= "https://ysharma-controlnet-image-comparison.hf.space/file=' + filename + '" alt="Control Net Image"/>'
33
  #https://ysharma-controlnetsegmentation.hf.space/file=/tmp/tmpqcz9yeta.png
34
  #https://ysharma-controlnet-image-comparison.hf.space/file=/tmp/tmpg4qx22xy.png
 
155
  'longbody, lowres, bad anatomy, bad hands, missing fingers, extra digit, fewer digits, cropped, worst quality, low quality'
156
  )
157
  with gr.Column():
158
+ result_gallery = gr.Gallery(label='Output', visible= False,
159
  show_label=False,
160
  elem_id='gallery').style(
161
  grid=2, height='auto')
162
  b1 = gr.Button('Get filenames')
163
+ filename = gr.Textbox(label="image file names", visible=False)
164
  b2 = gr.Button('Show Image-Comparison')
165
  imagecomp = gr.HTML()
166
  ips = [
 
169
  ]
170
  run_button.click(fn=process,
171
  inputs=ips,
172
+ outputs=[result_gallery, imagecomp],
173
  api_name='seg')
174
+ #b1.click(dummyfun, [result_gallery], [filename])
175
+ #b2.click(create_imgcomp, [input_image, filename], [imagecomp])
176
 
177
  return demo