-
Notifications
You must be signed in to change notification settings - Fork 1
/
app.py
32 lines (26 loc) · 857 Bytes
/
app.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
from flask import Flask, request
import re
import url_verify
import sms_text_verify
import json
app = Flask(__name__)
text_model = sms_text_verify.eng_news_zero_shot_model_pred()
@app.route('/sms_check', methods=['GET', 'POST'])
def method_name():
data = request.get_json()
sms = data['sms']
url = re.findall(r'https?://\S+|www\.\S+', sms)
result = dict()
if url:
# result['url'] = url[0]
result['url_result'] = url_verify.url_verify(url[0])
# text_model = sms_text_verify.eng_news_zero_shot_model_pred()
result['sms_result'] = (text_model.predict(sms))
json.dump(result, open('result.json', 'w'),separators=(',', ':'),
sort_keys=True,
indent=4)
res = json.loads(open('result.json').read())
print(res)
return res
if __name__ == '__main__':
app.run(debug=True)