retr04error commited on
Commit
55b1360
1 Parent(s): c61a89d

flaskAPI.py

Browse files
Files changed (1) hide show
  1. flaskAPI.py +0 -28
flaskAPI.py CHANGED
@@ -71,33 +71,5 @@ def check_vulnerabilities_api():
71
  except Exception as e:
72
  return jsonify({'error': str(e)}), 500
73
 
74
- def check_vulnerabilities_interface(solidity_file_url, file_id):
75
- model_directory = 'models/'
76
- device = 'cuda'
77
-
78
- try:
79
- response = requests.get(solidity_file_url)
80
- response.raise_for_status()
81
-
82
- with tempfile.NamedTemporaryFile(delete=False, suffix=f"_{file_id}.sol") as temp_file:
83
- temp_file.write(response.content)
84
- temp_file.flush()
85
- results = check_vulnerabilities(temp_file.name, model_directory, device)
86
- os.remove(temp_file.name)
87
- return results
88
-
89
- except requests.exceptions.RequestException as e:
90
- return {'error': f'Error fetching file: {e}'}
91
- except Exception as e:
92
- return {'error': str(e)}
93
-
94
- interface = gr.Interface(
95
- fn=check_vulnerabilities_interface,
96
- inputs=[gr.inputs.Textbox(label="Solidity File URL"), gr.inputs.Textbox(label="File ID")],
97
- outputs="json",
98
- title="Solidity Vulnerability Checker",
99
- description="Enter the URL of a Solidity file and a file ID to check for vulnerabilities."
100
- )
101
-
102
  if __name__ == '__main__':
103
  app.run()
 
71
  except Exception as e:
72
  return jsonify({'error': str(e)}), 500
73
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
74
  if __name__ == '__main__':
75
  app.run()