Gabriel commited on
Commit
3663121
1 Parent(s): 60ad418

docker issue

Browse files
Files changed (3) hide show
  1. app.py +4 -3
  2. tabs/htr_tool.py +5 -1
  3. tabs/stepwise_htr_tool.py +3 -1
app.py CHANGED
@@ -1,3 +1,4 @@
 
1
  import uuid
2
 
3
  import gradio as gr
@@ -35,9 +36,9 @@ with gr.Blocks(title="Riksarkivet", theme=theme, css=css) as demo:
35
  with gr.Tab("About"):
36
  about_tab.render()
37
 
38
- # SECRET_KEY = os.environ.get("AM_I_IN_A_DOCKER_CONTAINER", False)
39
- # if SECRET_KEY:
40
- demo.load(fn=TrafficDataHandler.onload_store_metric_data, inputs=None, outputs=None)
41
 
42
 
43
  demo.queue(concurrency_count=2, max_size=2)
 
1
+ import os
2
  import uuid
3
 
4
  import gradio as gr
 
36
  with gr.Tab("About"):
37
  about_tab.render()
38
 
39
+ SECRET_KEY = os.environ.get("AM_I_IN_A_DOCKER_CONTAINER", False)
40
+ if SECRET_KEY:
41
+ demo.load(fn=TrafficDataHandler.onload_store_metric_data, inputs=None, outputs=None)
42
 
43
 
44
  demo.queue(concurrency_count=2, max_size=2)
tabs/htr_tool.py CHANGED
@@ -1,3 +1,5 @@
 
 
1
  import gradio as gr
2
 
3
  from helper.examples.examples import DemoImages
@@ -263,4 +265,6 @@ with gr.Blocks() as htr_tool_tab:
263
  fast_track.get_text_from_coords, inputs=text_polygon_dict, outputs=selection_text_from_image_viewer
264
  )
265
 
266
- htr_pipeline_button.click(fn=TrafficDataHandler.store_metric_data, inputs=htr_pipeline_button_var)
 
 
 
1
+ import os
2
+
3
  import gradio as gr
4
 
5
  from helper.examples.examples import DemoImages
 
265
  fast_track.get_text_from_coords, inputs=text_polygon_dict, outputs=selection_text_from_image_viewer
266
  )
267
 
268
+ SECRET_KEY = os.environ.get("AM_I_IN_A_DOCKER_CONTAINER", False)
269
+ if SECRET_KEY:
270
+ htr_pipeline_button.click(fn=TrafficDataHandler.store_metric_data, inputs=htr_pipeline_button_var)
tabs/stepwise_htr_tool.py CHANGED
@@ -377,4 +377,6 @@ with gr.Blocks() as stepwise_htr_tool_tab:
377
  ],
378
  )
379
 
380
- region_segment_button.click(fn=TrafficDataHandler.store_metric_data, inputs=region_segment_button_var)
 
 
 
377
  ],
378
  )
379
 
380
+ SECRET_KEY = os.environ.get("AM_I_IN_A_DOCKER_CONTAINER", False)
381
+ if SECRET_KEY:
382
+ region_segment_button.click(fn=TrafficDataHandler.store_metric_data, inputs=region_segment_button_var)