ejschwartz commited on
Commit
b9a5fb3
·
verified ·
1 Parent(s): 1e73176

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -2
app.py CHANGED
@@ -43,16 +43,18 @@ examples = [
43
  ]
44
 
45
  # predict summary
46
- def predict_summary(tokenizer,code):
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(tokenizer,code):
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
  '''