From 2e7e9760c2bf4ad44de21214532197a62fd66f4c Mon Sep 17 00:00:00 2001 From: zovjsra <110753121@nccu.edu.tw> Date: Thu, 9 Feb 2023 06:35:38 +0000 Subject: [PATCH] Modify for docker --- Dockerfile | 10 ++++++++++ app.py | 8 ++++---- dataHandlerPTT.py | 4 ++-- templates/generalTxt.html | 30 +++++++++++++++++++----------- 4 files changed, 35 insertions(+), 17 deletions(-) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..559f6e8 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,10 @@ +FROM python:3.8.16-bullseye + +ADD . /app + +RUN pip install flask flask-compress jieba numpy progressbar2 nltk langdetect + +WORKDIR /app +RUN mkdir data + +ENTRYPOINT [ "/usr/local/bin/python", 'app.py' ] \ No newline at end of file diff --git a/app.py b/app.py index 392c94f..45f6149 100755 --- a/app.py +++ b/app.py @@ -6,8 +6,8 @@ from pprint import pprint import threading import random import string -import dataHandlerPTT as ptt -import dataHandlerPTTPush as pttPush +#import dataHandlerPTT as ptt +#import dataHandlerPTTPush as pttPush import generalText as gen import json @@ -57,7 +57,7 @@ def generalText_addText(): @app.route('/') def index(): - return redirect('/ptt') + return redirect('/generalTxt') @app.route('/ptt_push') @@ -157,4 +157,4 @@ def dcard_dev(): if __name__ == "__main__": - app.run(debug=False, port=4980, host='0.0.0.0', threaded=False) + app.run(debug=True, port=4980, host='0.0.0.0', threaded=False) diff --git a/dataHandlerPTT.py b/dataHandlerPTT.py index 0b62c86..437de0f 100755 --- a/dataHandlerPTT.py +++ b/dataHandlerPTT.py @@ -15,7 +15,7 @@ from numpy import prod from jieba import posseg from progressbar import ProgressBar from datetime import datetime -from PTTData import PTTData +#from PTTData import PTTData defaultDate = { @@ -29,7 +29,7 @@ with open('/home/vis/pttDatabase/PTTData/Gossiping/content/content.pck', 'rb') a f.close() defaultStopWords = [] -data = PTTData('Gossiping', '/home/vis/pttDatabase/PTTData') +#data = PTTData('Gossiping', '/home/vis/pttDatabase/PTTData') sentence_length = 100 use_push_count = False diff --git a/templates/generalTxt.html b/templates/generalTxt.html index 7c65940..b592e28 100644 --- a/templates/generalTxt.html +++ b/templates/generalTxt.html @@ -14,21 +14,27 @@

編輯停用詞

- - + +
- - - - + + + +
- - - +

泛用文字視覺化工具

@@ -38,7 +44,8 @@

使用繁體中文Jieba斷詞器,不保證簡體中文能夠正常使用。

- +