Skip to content

Commit adbf3ea

Browse files
authored
Merge pull request #12 from GYFX35/feat/text-analysis-api
feat: Create initial Flask API for text analysis
2 parents 0256233 + 4c5baf3 commit adbf3ea

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed

text_message_analyzer/app.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
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)
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Flask

0 commit comments

Comments
 (0)