ejschwartz commited on
Commit
fb5ce4e
·
1 Parent(s): 0416598

more processing

Browse files
Files changed (1) hide show
  1. app.py +12 -3
app.py CHANGED
@@ -20,6 +20,12 @@ This space simply performs inference on the two pretrained models available as
20
  part of the ReSym artifacts. It takes a variable name and some decompiled code
21
  as input, and outputs the variable type and other information.
22
 
 
 
 
 
 
 
23
  ## Todo
24
 
25
  * Add support for FieldDecoder model
@@ -57,9 +63,12 @@ example = r"""{
57
  def infer(var_name, code):
58
 
59
  splitcode = code.splitlines()
60
- comments = prep_decompiled.extract_comments(splitcode)
61
- sig = prep_decompiled.parse_signature(splitcode)
62
- print(f"comments={comments} sig={sig}")
 
 
 
63
 
64
  #line = json.loads(input)
65
  #first_token = line["output"].split(":")[0]
 
20
  part of the ReSym artifacts. It takes a variable name and some decompiled code
21
  as input, and outputs the variable type and other information.
22
 
23
+ ## Disclaimer
24
+
25
+ I'm not a ReSym developer and I may have messed something up. In particular,
26
+ you must prompt the variable names in the decompiled code as part of the prompt,
27
+ and I reused some of their own code to do this.
28
+
29
  ## Todo
30
 
31
  * Add support for FieldDecoder model
 
63
  def infer(var_name, code):
64
 
65
  splitcode = code.splitlines()
66
+ bodyvars = [v.name for v in prep_decompiled.extract_comments(splitcode) if hasattr(v, "name")]
67
+ argvars = [v.name for v in prep_decompiled.parse_signature(splitcode) if hasattr(v, "name")]
68
+ vars = argvars + bodyvars
69
+ #comments = prep_decompiled.extract_comments(splitcode)
70
+ #sig = prep_decompiled.parse_signature(splitcode)
71
+ print(f"vars {vars}")
72
 
73
  #line = json.loads(input)
74
  #first_token = line["output"].split(":")[0]