-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathapp.py
More file actions
31 lines (26 loc) · 818 Bytes
/
app.py
File metadata and controls
31 lines (26 loc) · 818 Bytes
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
from topicmodeller import TopicModeller
from topicdiscoverer import TopicDiscoverer
from flask import Flask, request
import pandas as pd
import json
app = Flask(__name__)
tm = None
td = None
@app.route('/topics', methods=['POST'])
def uploadFileForTopics():
if request.method == 'POST':
f = request.files['file']
artifacts = pd.read_csv(f)
vs = tm.CSV2Topics(artifacts)
return json.dumps(td.discover(vs))
@app.route('/count', methods=['POST'])
def uploadFileForWordCount():
if request.method == 'POST':
f = request.files['file']
artifacts = pd.read_csv(f)
return json.dumps(tm.CSV2TermAmount(artifacts))
if __name__ == '__main__':
shouldUseDump = True
tm = TopicModeller(shouldUseDump)
td = TopicDiscoverer()
app.run(debug=True)