Modify for docker

master
zovjsra 2 years ago
parent cd07e4f5f4
commit 2e7e9760c2

@ -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' ]

@ -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)

@ -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

@ -14,21 +14,27 @@
<h4 id="sweTitle" style="margin:10px; display: inline;">編輯停用詞</h4>
<ul id="sweContainer" class="w3-ul w3-hoverable" style="margin-bottom: 10px;"></ul>
<div>
<input class="w3-input w3-border" style="width: 85%; display: inline;" type="text" id="newStopWord" placeholder="新增停用詞(以空白隔開)">
<button class="general-button w3-right" type="button" id="confirm" style="background-color: #379; margin-left: 8px;" onclick="addStopWord()">新增</button>
<input class="w3-input w3-border" style="width: 85%; display: inline;" type="text" id="newStopWord"
placeholder="新增停用詞(以空白隔開)">
<button class="general-button w3-right" type="button" id="confirm"
style="background-color: #379; margin-left: 8px;" onclick="addStopWord()">新增</button>
</div>
<div id="sweButtons" style="margin: 20px 0px;">
<button class="general-button" type="button" id="confirm" style="background-color: #379; margin: 0px 10px" onclick="hideStopWordEditor(); submit()">確認</button>
<button class="general-button" type="button" id="confirm" style="background-color: #379; margin: 0px 10px" onclick="downloadStopWord()">匯出停用詞</button>
<button class="general-button" type="button" id="confirm" style="background-color: #379; margin: 0px 10px" onclick="clearStopWord()">全部清除</button>
<button class="general-button w3-right" type="button" id="confirm" style="background-color: #379; margin: 0px 20px" onclick="hideStopWordEditor()">返回</button>
<button class="general-button" type="button" id="confirm"
style="background-color: #379; margin: 0px 10px"
onclick="hideStopWordEditor(); submit()">確認</button>
<button class="general-button" type="button" id="confirm"
style="background-color: #379; margin: 0px 10px" onclick="downloadStopWord()">匯出停用詞</button>
<button class="general-button" type="button" id="confirm"
style="background-color: #379; margin: 0px 10px" onclick="clearStopWord()">全部清除</button>
<button class="general-button w3-right" type="button" id="confirm"
style="background-color: #379; margin: 0px 20px" onclick="hideStopWordEditor()">返回</button>
</div>
</div>
</div>
<div class='w3-bar w3-teal'>
<button class="w3-button w3-teal" type="button" onclick="location.href='/ptt'">PTT Sententree</button>
<button class="w3-button" type="button" onclick="location.href='/ptt_push'">推文Sententree</button>
<button class="w3-button w3-teal" type="button" onclick="location.href='/generalTxt'" style="color: darkseagreen;">泛用文字視覺化工具</button>
<button class="w3-button w3-teal" type="button" onclick="location.href='/generalTxt'"
style="color: darkseagreen;">泛用文字視覺化工具</button>
</div>
<div id='heading'>
<h2>泛用文字視覺化工具</h2>
@ -38,7 +44,8 @@
<p id='comment'>使用繁體中文Jieba斷詞器不保證簡體中文能夠正常使用。</p>
</div>
<div style="margin:10px;">
<button class="general-button" type="button" id="editSWButton" style="margin:10px 0px;" onclick="showStopwordEditor()">編輯停用詞</button>
<button class="general-button" type="button" id="editSWButton" style="margin:10px 0px;"
onclick="showStopwordEditor()">編輯停用詞</button>
</div>
<div id='rawText' class=''>
<textarea id='rawTextBox' rows=25 placeholder="輸入要視覺化的文字
@ -46,7 +53,8 @@
<button class='general-button' style='margin: 10px 0px' onclick="submit()">提交</button>
</div>
<div>
<button id='toggleTextBox' class='general-button' style='margin: 0px 10px' onclick="switchMessageBox()">隱藏文字視窗</button>
<button id='toggleTextBox' class='general-button' style='margin: 0px 10px'
onclick="switchMessageBox()">隱藏文字視窗</button>
<div id='graph' class='hidden'>
<div id='vis'></div>
</div>

Loading…
Cancel
Save