Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -6,6 +6,41 @@ model_name = "ejschwartz/hext5" # Replace with your desired model
|
|
6 |
model = T5ForConditionalGeneration.from_pretrained(model)
|
7 |
tokenizer = AutoTokenizer.from_pretrained(model)
|
8 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
|
10 |
# predict summary
|
11 |
def predict_summary(tokenizer,code):
|
@@ -17,7 +52,7 @@ def predict_summary(tokenizer,code):
|
|
17 |
|
18 |
# predict identifier (func name)
|
19 |
def predict_identifier(tokenizer,code):
|
20 |
-
|
21 |
'''
|
22 |
code should be like: "unsigned __int8 *__cdecl <func>(int *<var_0>,...){ return <func_1>(1);}"
|
23 |
'''
|
@@ -31,7 +66,8 @@ iface = gr.Interface(
|
|
31 |
inputs="text",
|
32 |
outputs="text",
|
33 |
title="Predict identifiers",
|
34 |
-
description="Enter a prompt and see the model generate text."
|
|
|
35 |
)
|
36 |
|
37 |
# Launch the interface
|
|
|
6 |
model = T5ForConditionalGeneration.from_pretrained(model)
|
7 |
tokenizer = AutoTokenizer.from_pretrained(model)
|
8 |
|
9 |
+
examples = [
|
10 |
+
"""void __fastcall __noreturn <func>(int a1, int a2, char a3, __int64 a4, __int64 a5)
|
11 |
+
{
|
12 |
+
__int64 v5; // rdi
|
13 |
+
int v6; // ebx
|
14 |
+
const char *v9; // rsi
|
15 |
+
char *v10; // r12
|
16 |
+
char *v11; // r13
|
17 |
+
char *v12; // rax
|
18 |
+
char v13[42]; // [rsp+Eh] [rbp-2Ah] BYREF
|
19 |
+
|
20 |
+
v5 = (unsigned int)(a1 - 1);
|
21 |
+
v6 = status;
|
22 |
+
if ( (unsigned int)v5 <= 3 )
|
23 |
+
{
|
24 |
+
v9 = (&off_413A60)[v5];
|
25 |
+
if ( a2 < 0 )
|
26 |
+
{
|
27 |
+
v13[0] = a3;
|
28 |
+
v11 = v13;
|
29 |
+
v10 = &asc_412691[-a2];
|
30 |
+
v13[1] = 0;
|
31 |
+
}
|
32 |
+
else
|
33 |
+
{
|
34 |
+
v10 = "--";
|
35 |
+
v11 = *(char **)(a4 + 32LL * a2);
|
36 |
+
}
|
37 |
+
v12 = dcgettext(0LL, v9, 5);
|
38 |
+
error(v6, 0, v12, v10, v11, a5);
|
39 |
+
abort();
|
40 |
+
}
|
41 |
+
abort();
|
42 |
+
}"""
|
43 |
+
]
|
44 |
|
45 |
# predict summary
|
46 |
def predict_summary(tokenizer,code):
|
|
|
52 |
|
53 |
# predict identifier (func name)
|
54 |
def predict_identifier(tokenizer,code):
|
55 |
+
global model
|
56 |
'''
|
57 |
code should be like: "unsigned __int8 *__cdecl <func>(int *<var_0>,...){ return <func_1>(1);}"
|
58 |
'''
|
|
|
66 |
inputs="text",
|
67 |
outputs="text",
|
68 |
title="Predict identifiers",
|
69 |
+
description="Enter a prompt and see the model generate text.",
|
70 |
+
examples=examples
|
71 |
)
|
72 |
|
73 |
# Launch the interface
|