-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathapp.py
More file actions
56 lines (44 loc) · 1.58 KB
/
app.py
File metadata and controls
56 lines (44 loc) · 1.58 KB
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# coding=utf-8
# Pro1
import pickup
# Pro2
import main_pro2
import sents2vec
from preprocess_autosummary import get_word_frequency,sentence_and_doc
from flask_wtf import FlaskForm
from flask import Flask, render_template, request # 引入类
class NameForm(FlaskForm):
text = ''
app = Flask(__name__) # Flask实例化一个对象,与我们当前运行的模块名当做参数
app.config["SECRET_KEY"] = "12345678"
@app.route('/')
def hh():
return render_template('index.html')
content1 = None
@app.route('/news-extraction', methods=["POST","GET"])
def deal_project1():
form = NameForm()
if request.form:
global content1
content1 = request.form.get("desc")
#print(content)
user_input = content1
form.text = pickup.main(user_input)
return render_template('news-extraction.html',text=form.text, form=form)
else:
return render_template('news-extraction.html',form=form) # 没提交的时候显示页面
content2 = None
@app.route("/autoSummary", methods=["POST", "GET"])
def deal_project2():
form = NameForm()
if request.form:
global content2
content2 = request.form.get("desc")
#print(content)
user_input = content2
form.text = main_pro2.autoSummary(user_input)
return render_template('autoSummary.html',text=form.text, form=form)
else:
return render_template('autoSummary.html',form=form) # 没提交的时候显示页面
if __name__ == '__main__':
app.run(host="0.0.0.0", port=5000, debug=True)