Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -43,16 +43,18 @@ examples = [
|
|
43 |
]
|
44 |
|
45 |
# predict summary
|
46 |
-
def predict_summary(
|
47 |
global model
|
|
|
48 |
input = tokenizer('summarize: '+code,return_tensors='pt',max_length=max_input_length,truncation=True)
|
49 |
output = model.generate(**input,max_new_tokens=256)[0]
|
50 |
return tokenizer.decode(output,skip_special_tokens=True)
|
51 |
|
52 |
|
53 |
# predict identifier (func name)
|
54 |
-
def predict_identifier(
|
55 |
global model
|
|
|
56 |
'''
|
57 |
code should be like: "unsigned __int8 *__cdecl <func>(int *<var_0>,...){ return <func_1>(1);}"
|
58 |
'''
|
|
|
43 |
]
|
44 |
|
45 |
# predict summary
|
46 |
+
def predict_summary(code):
|
47 |
global model
|
48 |
+
global tokenizer
|
49 |
input = tokenizer('summarize: '+code,return_tensors='pt',max_length=max_input_length,truncation=True)
|
50 |
output = model.generate(**input,max_new_tokens=256)[0]
|
51 |
return tokenizer.decode(output,skip_special_tokens=True)
|
52 |
|
53 |
|
54 |
# predict identifier (func name)
|
55 |
+
def predict_identifier(code):
|
56 |
global model
|
57 |
+
global tokenizer
|
58 |
'''
|
59 |
code should be like: "unsigned __int8 *__cdecl <func>(int *<var_0>,...){ return <func_1>(1);}"
|
60 |
'''
|