Ai
1 Star 0 Fork 6

chenhepg/NLP文本摘要网页demo

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
flask_server.py 1.17 KB
一键复制 编辑 原始数据 按行查看 历史
蒋茂苇 提交于 2021-12-18 15:13 +08:00 . update flask_server.py.
from flask import Flask,url_for,request,render_template
from nlpfc import query
from summarization import abstract_fc
# from flask import Flask,render_template
app = Flask(__name__)
@app.route("/")#主页设置为“0.0.0.0”以使服务器在外部可用
def index():
return render_template('index.html')
@app.route('/', methods=['POST', 'GET'])
def my_form_post():
text = request.form ['text']
print(text)
print(type(text))
output = query({#生成式摘要输出结果
"inputs": text
})
output1 = abstract_fc(text)#抽取式摘要输出结果
print(output)
return render_template('index.html',variable=output,variable_textrank=output1)
# if request.method == 'POST':
# if request.form['user'] == 'admin':
# return 'Admin login successfully!'
# else:
# return 'No such user!'
# if request.method == "POST":
# username = request.values.get("username")
# sex = request.values.get("sex")
if __name__ == "__main__":
app.run() #app.run(host, port, debug, options)
#基本参数设置解释
#https://www.w3cschool.cn/flask/flask_application.html
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/chenhepg/nlp.git
git@gitee.com:chenhepg/nlp.git
chenhepg
nlp
NLP文本摘要网页demo
master

搜索帮助