You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
45 lines
832 B
45 lines
832 B
#!/usr/bin/python |
|
#-*- coding:utf-8 -*- |
|
|
|
import random |
|
import json |
|
from flask import Flask |
|
import tfidf |
|
from flask_cors import CORS |
|
from flask import jsonify |
|
from flask import request |
|
import summarycreator |
|
import spacy |
|
|
|
|
|
|
|
|
|
app = Flask(__name__) |
|
#CORS(app) |
|
|
|
nlp_model_en = "en_core_web_lg" |
|
|
|
nlp_eng = spacy.load(nlp_model_en) |
|
|
|
@app.route('/') |
|
def index(): |
|
return "<h2>hello, the service is running. </h2>" |
|
|
|
|
|
@app.route('/tryspacy', methods=['GET', 'POST']) |
|
def tryspacy(): |
|
a = request.args.get('a') |
|
#a = request.form['a'] |
|
#print(a) |
|
b = json.loads(a) |
|
return jsonify(answer=summarycreator.run(b,nlp_eng)) |
|
|
|
@app.route('/info', methods=['GET', 'POST']) |
|
def info(): |
|
return jsonify(answer="hallo") |
|
|
|
if __name__ == "__main__": |
|
app.run(ssl_context='adhoc') |
|
#app.run(ssl_context=('cert.pem', 'key.pem')) |
|
|
|
|
|
|