oskarastrom commited on
Commit
c8cf97b
·
1 Parent(s): 058f18b

Update result_ui.py

Browse files
Files changed (1) hide show
  1. gradio_scripts/result_ui.py +7 -1
gradio_scripts/result_ui.py CHANGED
@@ -1,6 +1,7 @@
1
  import gradio as gr
2
  import numpy as np
3
  from gradio_scripts.pdf_handler import make_pdf
 
4
 
5
  js_update_tab_labels = """
6
  async () => {
@@ -42,12 +43,17 @@ def update_result(i, state, result, inference_handler):
42
 
43
  make_pdf(state['index']-1, state, result, table_headers)
44
 
 
 
 
 
45
  # Send update to UI, and to inference_handler to start next file inference
 
46
  print("loaded result")
47
  return {
48
  zip_out: gr.update(value=result["path_zip"]),
49
  tabs[i]['tab']: gr.update(),
50
- tabs[i]['video']: gr.update(value=result["path_video"][i], visible=True),
51
  tabs[i]['metadata']: gr.update(value=result["fish_info"][i], visible=True),
52
  tabs[i]['table']: gr.update(value=result["fish_table"][i], visible=True),
53
  tabs[i]['annotation_btn']: gr.update(visible=annotation_avaliable),
 
1
  import gradio as gr
2
  import numpy as np
3
  from gradio_scripts.pdf_handler import make_pdf
4
+ import os
5
 
6
  js_update_tab_labels = """
7
  async () => {
 
43
 
44
  make_pdf(state['index']-1, state, result, table_headers)
45
 
46
+ # Check if files exist
47
+ video_path = result["path_video"][i]
48
+ if not os.path.exists(video_path): video_path = ""
49
+
50
  # Send update to UI, and to inference_handler to start next file inference
51
+
52
  print("loaded result")
53
  return {
54
  zip_out: gr.update(value=result["path_zip"]),
55
  tabs[i]['tab']: gr.update(),
56
+ tabs[i]['video']: gr.update(value=video_path, visible=True),
57
  tabs[i]['metadata']: gr.update(value=result["fish_info"][i], visible=True),
58
  tabs[i]['table']: gr.update(value=result["fish_table"][i], visible=True),
59
  tabs[i]['annotation_btn']: gr.update(visible=annotation_avaliable),