Pouriarouzrokh commited on
Commit
2a675dd
·
1 Parent(s): 48fd666

added cache examples

Browse files
Files changed (1) hide show
  1. app.py +8 -2
app.py CHANGED
@@ -114,6 +114,12 @@ def rotate_btn_fn(img_path, xt, yt, zt, add_bone_cmap=False):
114
 
115
  def use_current_btn_fn(input_img):
116
  return input_img
 
 
 
 
 
 
117
 
118
  css_style = "./style.css"
119
  callback = gr.CSVLogger()
@@ -132,7 +138,7 @@ with gr.Blocks(css=css_style) as app:
132
  inputs = [input_img],
133
  label = "Xray Examples",
134
  elem_id='examples',
135
- cache_examples=True,
136
  outputs=output_img
137
  )
138
  gr.Examples(
@@ -140,7 +146,7 @@ with gr.Blocks(css=css_style) as app:
140
  inputs = [input_img],
141
  label = "DRR Examples",
142
  elem_id='examples',
143
- cache_examples=True,
144
  outputs=output_img
145
  )
146
  with gr.Row():
 
114
 
115
  def use_current_btn_fn(input_img):
116
  return input_img
117
+
118
+ def retrieve_examples(examples, inputs):
119
+ global current_img
120
+ if current_img is not None:
121
+ return current_img
122
+ return examples[0]
123
 
124
  css_style = "./style.css"
125
  callback = gr.CSVLogger()
 
138
  inputs = [input_img],
139
  label = "Xray Examples",
140
  elem_id='examples',
141
+ cache_examples="lazy",
142
  outputs=output_img
143
  )
144
  gr.Examples(
 
146
  inputs = [input_img],
147
  label = "DRR Examples",
148
  elem_id='examples',
149
+ cache_examples="lazy",
150
  outputs=output_img
151
  )
152
  with gr.Row():