Edward J. Schwartz commited on
Commit
b4f4d50
·
1 Parent(s): 1d7fc0d
Files changed (1) hide show
  1. app.py +8 -3
app.py CHANGED
@@ -5,10 +5,12 @@ import re
5
  import subprocess
6
  import tempfile
7
 
 
 
8
  import numpy
9
  print(numpy.__version__)
10
 
11
- model = gr.load("ejschwartz/oo-method-test-model-bylibrary", src="models")
12
 
13
  # gr.load("ejschwartz/oo-method-test-model-bylibrary", src="models", examples=[
14
  # '\nL1: 55 ?? push ebp\n 8b ec ?? mov ebp, esp\n 5d ?? pop ebp\n c3 ?? ret\n\n',
@@ -101,10 +103,13 @@ with gr.Blocks() as demo:
101
  def function_change_fn(selected_fun, fun_data):
102
 
103
  disassembly_str = fun_data[int(selected_fun, 16)].decode("utf-8")
104
- model_results = model(disassembly_str)
105
  disassembly_str = str(model_results)
106
 
107
- return {disassembly: gr.Textbox.update(value=disassembly_str)}
 
 
 
108
 
109
  file_widget.change(file_change_fn, file_widget, [col, fun_dropdown, all_dis_state])
110
 
 
5
  import subprocess
6
  import tempfile
7
 
8
+ import transformers
9
+
10
  import numpy
11
  print(numpy.__version__)
12
 
13
+ pipe = transformers.pipeline(model="ejschwartz/oo-method-test-model-bylibrary", return_all_scores=True)
14
 
15
  # gr.load("ejschwartz/oo-method-test-model-bylibrary", src="models", examples=[
16
  # '\nL1: 55 ?? push ebp\n 8b ec ?? mov ebp, esp\n 5d ?? pop ebp\n c3 ?? ret\n\n',
 
103
  def function_change_fn(selected_fun, fun_data):
104
 
105
  disassembly_str = fun_data[int(selected_fun, 16)].decode("utf-8")
106
+ model_results = pipe(disassembly_str)
107
  disassembly_str = str(model_results)
108
 
109
+ return {disassembly: gr.Textbox.update(value=disassembly_str),
110
+ #class: gr.Label.update()
111
+ #clazz: gr.Label.update(value="Method" if model_results[0]["label"] == "method" else "Function")}
112
+ }
113
 
114
  file_widget.change(file_change_fn, file_widget, [col, fun_dropdown, all_dis_state])
115