File tree Expand file tree Collapse file tree 2 files changed +11
-8
lines changed
src/backend/neploy-build-python Expand file tree Collapse file tree 2 files changed +11
-8
lines changed Original file line number Diff line number Diff line change 30
30
31
31
# Evaluate the model
32
32
y_pred = model .predict (X_test )
33
- print (classification_report (y_test , y_pred ))
33
+ # print(classification_report(y_test, y_pred))
34
34
35
35
# Read the file containing the Python smart contract script
36
36
with open ("test.py" , "r" ) as f :
45
45
prediction = model .predict (new_code_vectorized )[0 ]
46
46
47
47
# Print the improvement suggestions
48
+ if not lines [i ]:
49
+ print ("{}" .format (lines [i ]))
50
+ continue
48
51
if prediction == "optimize" :
49
- print ("Line {}: The following are the suggested optimization snippets: " .format (i + 1 ))
50
- for snippet in model .predict_proba (new_code_vectorized )[0 ]:
51
- print (snippet )
52
+ print ("[optimised]: {}" .format (lines [ i ] ))
53
+ # for snippet in model.predict_proba(new_code_vectorized)[0]:
54
+ # print(snippet)
52
55
else :
53
- print ("Line {}: The code is fine. " .format (i + 1 ))
56
+ print ("[ ok ]: {} " .format (lines [ i ] ))
Original file line number Diff line number Diff line change @@ -68,11 +68,11 @@ def optimise_endpoint():
68
68
}
69
69
70
70
if result .returncode != 0 :
71
- response_data ["message" ] = "Failed to optimise code"
71
+ response_data ["message" ] = "Failed to review code"
72
72
elif 'ERROR' in result .stderr :
73
- response_data ["message" ] = "Failed to optimise code"
73
+ response_data ["message" ] = "Failed to review code"
74
74
else :
75
- response_data ["message" ] = "Code is optmized successfully"
75
+ response_data ["message" ] = "Code is reviewed successfully"
76
76
return jsonify (response_data ), 200
77
77
except Exception as e :
78
78
os .remove (temp_filename ) # Delete the temporary file
You can’t perform that action at this time.
0 commit comments