Spaces:
Sleeping
Sleeping
Edward J. Schwartz
commited on
Commit
·
96362ce
1
Parent(s):
11c28fc
Use .fn instead of __call__
Browse files
app.py
CHANGED
@@ -10,7 +10,7 @@ import transformers
|
|
10 |
import numpy
|
11 |
print(numpy.__version__)
|
12 |
|
13 |
-
pipe = transformers.pipeline(model="ejschwartz/oo-method-test-model-bylibrary", top_k=2)
|
14 |
model = gr.load("ejschwartz/oo-method-test-model-bylibrary", src="models")
|
15 |
|
16 |
# gr.load("ejschwartz/oo-method-test-model-bylibrary", src="models", examples=[
|
@@ -104,13 +104,13 @@ with gr.Blocks() as demo:
|
|
104 |
def function_change_fn(selected_fun, fun_data):
|
105 |
|
106 |
disassembly_str = fun_data[int(selected_fun, 16)].decode("utf-8")
|
107 |
-
model_results = pipe(disassembly_str)
|
108 |
-
load_results = model(disassembly_str)
|
109 |
#top_k = {i["label"].split(", ")[0]: i["score"] for i in model_results}
|
110 |
-
disassembly_str = str(model_results) + str(load_results)
|
111 |
|
112 |
return {disassembly: gr.Textbox.update(value=disassembly_str),
|
113 |
-
|
114 |
#clazz: gr.Label.update(value="Method" if model_results[0]["label"] == "method" else "Function")}
|
115 |
}
|
116 |
|
|
|
10 |
import numpy
|
11 |
print(numpy.__version__)
|
12 |
|
13 |
+
#pipe = transformers.pipeline(model="ejschwartz/oo-method-test-model-bylibrary", top_k=2)
|
14 |
model = gr.load("ejschwartz/oo-method-test-model-bylibrary", src="models")
|
15 |
|
16 |
# gr.load("ejschwartz/oo-method-test-model-bylibrary", src="models", examples=[
|
|
|
104 |
def function_change_fn(selected_fun, fun_data):
|
105 |
|
106 |
disassembly_str = fun_data[int(selected_fun, 16)].decode("utf-8")
|
107 |
+
#model_results = pipe(disassembly_str)
|
108 |
+
load_results = model.fn(disassembly_str)
|
109 |
#top_k = {i["label"].split(", ")[0]: i["score"] for i in model_results}
|
110 |
+
#disassembly_str = str(model_results) + str(load_results)
|
111 |
|
112 |
return {disassembly: gr.Textbox.update(value=disassembly_str),
|
113 |
+
clazz: gr.Label.update(top_k)
|
114 |
#clazz: gr.Label.update(value="Method" if model_results[0]["label"] == "method" else "Function")}
|
115 |
}
|
116 |
|