ejschwartz commited on
Commit
5fcff16
·
1 Parent(s): 8464e89

Fix progress

Browse files
Files changed (1) hide show
  1. main.py +7 -7
main.py CHANGED
@@ -20,7 +20,7 @@ with gr.Blocks() as demo:
20
 
21
  all_dis_state = gr.State()
22
 
23
- gr.Markdown(
24
  """
25
  # DIRTY-Ghidra Testing
26
  First, upload a binary.
@@ -51,7 +51,7 @@ with gr.Blocks() as demo:
51
  #interpret_button = gr.Button("Interpret (very slow)")
52
  #interpretation = gr.components.Interpretation(disassembly)
53
 
54
- def file_change_fn(file, progress=gr.Progress()):
55
 
56
  if file is None:
57
  return {
@@ -60,10 +60,9 @@ with gr.Blocks() as demo:
60
  }
61
  else:
62
 
63
- #fun_data = {42: 2, 43: 3}
64
- #new_binary(file)
65
- progress(0, desc="Analyzing binary...")
66
  try:
 
 
67
  fun_data = get_functions(file.name)
68
  #print(fun_data)
69
 
@@ -76,8 +75,9 @@ with gr.Blocks() as demo:
76
  fun_dropdown: gr.Dropdown(choices=addrs, value=addrs[0][1]),
77
  all_dis_state: fun_data
78
  }
79
-
80
- file_widget.change(file_change_fn, file_widget, outputs=[col, fun_dropdown, all_dis_state])
 
81
 
82
  # spaces only shows stderr..
83
  os.dup2(sys.stdout.fileno(), sys.stderr.fileno())
 
20
 
21
  all_dis_state = gr.State()
22
 
23
+ intro = gr.Markdown(
24
  """
25
  # DIRTY-Ghidra Testing
26
  First, upload a binary.
 
51
  #interpret_button = gr.Button("Interpret (very slow)")
52
  #interpretation = gr.components.Interpretation(disassembly)
53
 
54
+ def file_change_fn(file):
55
 
56
  if file is None:
57
  return {
 
60
  }
61
  else:
62
 
 
 
 
63
  try:
64
+ progress = gr.Progress()
65
+ progress(0, desc="Analyzing binary...")
66
  fun_data = get_functions(file.name)
67
  #print(fun_data)
68
 
 
75
  fun_dropdown: gr.Dropdown(choices=addrs, value=addrs[0][1]),
76
  all_dis_state: fun_data
77
  }
78
+
79
+ # Need to put intro as output to get progress to work!
80
+ file_widget.change(file_change_fn, file_widget, outputs=[intro, col, fun_dropdown, all_dis_state])
81
 
82
  # spaces only shows stderr..
83
  os.dup2(sys.stdout.fileno(), sys.stderr.fileno())