File tree Expand file tree Collapse file tree 2 files changed +29
-0
lines changed
Expand file tree Collapse file tree 2 files changed +29
-0
lines changed Original file line number Diff line number Diff line change 1+ from flask import Flask , request , jsonify
2+
3+ app = Flask (__name__ )
4+
5+ @app .route ("/" )
6+ def hello ():
7+ return "Hello, World!"
8+
9+ @app .route ('/analyze' , methods = ['POST' ])
10+ def analyze ():
11+ data = request .get_json ()
12+ if not data or 'text' not in data :
13+ return jsonify ({'error' : 'Invalid input, "text" field is required.' }), 400
14+
15+ text_to_analyze = data ['text' ]
16+
17+ # Placeholder analysis logic
18+ is_suspicious = 'phishing' in text_to_analyze .lower ()
19+
20+ return jsonify ({
21+ 'text' : text_to_analyze ,
22+ 'analysis' : {
23+ 'is_suspicious' : is_suspicious
24+ }
25+ })
26+
27+ if __name__ == "__main__" :
28+ app .run (host = "0.0.0.0" , port = 8080 )
Original file line number Diff line number Diff line change 1+ Flask
You can’t perform that action at this time.
0 commit comments