-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.py
More file actions
37 lines (29 loc) · 1.02 KB
/
index.py
File metadata and controls
37 lines (29 loc) · 1.02 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
from flask import Flask, render_template, request, json
from TextSummarization import TextSummarzation
app = Flask(__name__)
@app.route('/')
def main():
return render_template('login.html')
@app.route('/import', methods=['GET ','POST'])
def import_data():
_url = request.form['url']
text = ts.get_text_from_url(_url)
return render_template('login.html', message=text)
@app.route('/stopwords')
def show_without_stopwords():
# call get text from url to get text data
text = ts.remove_stopwords()
return render_template('login.html', message=text)
@app.route('/tokenize')
def tokenize():
# call ts function tokenize to create tokens and dispaly it on screen
tokens = ts.word_tokens()
return render_template('login.html', message=tokens)
@app.route('/summarize')
def summarize():
# call ts function summarize to summarize and display it on screen
data = ts.summarize()
return render_template('login.html', text=data)
if __name__ == '__main__':
ts = TextSummarzation()
app.run()