ejschwartz commited on
Commit
b7f5591
·
1 Parent(s): d49c75c

remove state

Browse files
Files changed (1) hide show
  1. app.py +4 -8
app.py CHANGED
@@ -34,8 +34,6 @@ def _resolve_uploaded_path(file_value: Any) -> str:
34
 
35
 
36
  with gr.Blocks() as demo:
37
- state = gr.State()
38
-
39
  intro = gr.Markdown(INTRO_TEXT)
40
 
41
  file_widget = gr.File(label="Executable file")
@@ -77,16 +75,15 @@ with gr.Blocks() as demo:
77
  gr.Examples(
78
  examples=examples,
79
  inputs=file_widget,
80
- outputs=[state, disassembly, original_decompile],
81
  )
82
 
83
- @file_widget.change(inputs=file_widget, outputs=[intro, state, col, fun_dropdown])
84
  def file_change_fn(file):
85
  if file is None:
86
  return {
87
  intro: INTRO_TEXT,
88
  col: gr.update(visible=False),
89
- state: {"file": None, "selected_fun": None},
90
  fun_dropdown: gr.update(choices=["Woohoo!"], value=None),
91
  }
92
 
@@ -103,11 +100,10 @@ with gr.Blocks() as demo:
103
  intro: markdown_value,
104
  col: gr.update(visible=True),
105
  fun_dropdown: gr.update(choices=funs, value=None),
106
- state: {"file": file, "selected_fun": None},
107
  }
108
 
109
- @fun_dropdown.change(inputs=[fun_dropdown, state], outputs=[disassembly, original_decompile])
110
- def function_change_fn(selected_fun, state):
111
 
112
  print("Selected function:", selected_fun)
113
 
 
34
 
35
 
36
  with gr.Blocks() as demo:
 
 
37
  intro = gr.Markdown(INTRO_TEXT)
38
 
39
  file_widget = gr.File(label="Executable file")
 
75
  gr.Examples(
76
  examples=examples,
77
  inputs=file_widget,
78
+ outputs=[disassembly, original_decompile],
79
  )
80
 
81
+ @file_widget.change(inputs=file_widget, outputs=[intro, col, fun_dropdown])
82
  def file_change_fn(file):
83
  if file is None:
84
  return {
85
  intro: INTRO_TEXT,
86
  col: gr.update(visible=False),
 
87
  fun_dropdown: gr.update(choices=["Woohoo!"], value=None),
88
  }
89
 
 
100
  intro: markdown_value,
101
  col: gr.update(visible=True),
102
  fun_dropdown: gr.update(choices=funs, value=None),
 
103
  }
104
 
105
+ @fun_dropdown.change(inputs=fun_dropdown, outputs=[disassembly, original_decompile])
106
+ def function_change_fn(selected_fun):
107
 
108
  print("Selected function:", selected_fun)
109