maxbetjes commited on
Commit
d319067
·
verified ·
1 Parent(s): f5ae7ba

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -4
app.py CHANGED
@@ -145,12 +145,14 @@ def update_with_example(filepath):
145
  fpath, fext = os.path.splitext(filepath)
146
 
147
  filepath = fpath+ '.tif'
 
 
148
 
149
  return (filepath_show, [((5, 5, 10, 10), 'nothing')]), [filepath], (fp0, [((5, 5, 10, 10), 'nothing')])
150
 
151
- def example(filepath):
152
- print(filepath)
153
- return(filepath)
154
 
155
  def update_button(filepath, z):
156
  print('update_btn')
@@ -326,7 +328,7 @@ with gr.Blocks(title = "Hello",
326
 
327
  #gr.Examples(sample_list, fn = update_with_example, inputs=input_image, outputs = [input_image, up_btn, output_image], examples_per_page=50, label = "Click on an example to try it")
328
  example_image = gr.Image(visible=False, type='filepath')
329
- gr.Examples(sample_list, fn= example, inputs=example_image, outputs=[example_image], examples_per_page=5, label = "Click on an example to try it")
330
  #input_image.upload(update_button, [input_image, depth], [input_image, up_btn, output_image])
331
  up_btn.upload(update_image, [up_btn, depth], [input_image, up_btn, output_image])
332
  depth.change(update_z, [up_btn, down_btn, down_btn2, depth], [input_image, output_image])
 
145
  fpath, fext = os.path.splitext(filepath)
146
 
147
  filepath = fpath+ '.tif'
148
+ filepath = filepath.split('/')[-1]
149
+ filepath = "./gradio_examples/"+filepath
150
 
151
  return (filepath_show, [((5, 5, 10, 10), 'nothing')]), [filepath], (fp0, [((5, 5, 10, 10), 'nothing')])
152
 
153
+ #def example(filepath):
154
+ # print(filepath)
155
+ # return(filepath)
156
 
157
  def update_button(filepath, z):
158
  print('update_btn')
 
328
 
329
  #gr.Examples(sample_list, fn = update_with_example, inputs=input_image, outputs = [input_image, up_btn, output_image], examples_per_page=50, label = "Click on an example to try it")
330
  example_image = gr.Image(visible=False, type='filepath')
331
+ gr.Examples(sample_list, fn= update_with_example, inputs=example_image, outputs=[input_image, up_btn, output_image], examples_per_page=5, label = "Click on an example to try it")
332
  #input_image.upload(update_button, [input_image, depth], [input_image, up_btn, output_image])
333
  up_btn.upload(update_image, [up_btn, depth], [input_image, up_btn, output_image])
334
  depth.change(update_z, [up_btn, down_btn, down_btn2, depth], [input_image, output_image])