This commit is contained in:
parent
49e6e2d29e
commit
6e232e78ad
|
@ -12,4 +12,4 @@ COPY . .
|
|||
EXPOSE 5000
|
||||
|
||||
# 确保模块名和 Flask 实例名正确(默认是 app:app)
|
||||
CMD ["waitress-serve", "--host=0.0.0.0", "--port=5000", "app:app"]
|
||||
CMD ["gunicorn", "-w", "2", "-k", "gthread", "--threads", "4", "-b", "0.0.0.0:5000", "app:app"]
|
||||
|
|
Binary file not shown.
|
@ -15,7 +15,7 @@ SAVE_DIR = "./cate1" # 模型路径
|
|||
LABEL_ENCODER_PATH = "cate1/label_encoder.pkl" # 标签映射器路径
|
||||
|
||||
app = Flask(__name__)
|
||||
|
||||
app.config['JSON_AS_ASCII'] = False
|
||||
# 全局变量锁
|
||||
model_lock = threading.Lock()
|
||||
|
||||
|
@ -124,6 +124,7 @@ def health_check():
|
|||
|
||||
|
||||
if __name__ == '__main__':
|
||||
# 生产环境建议使用:
|
||||
# gunicorn -w 4 -b 0.0.0.0:5000 app:app --timeout 120
|
||||
app.run(host='0.0.0.0', port=5002, threaded=True)
|
||||
app.run(host='0.0.0.0', port=5000, threaded=True)
|
||||
else:
|
||||
application = app # 兼容 WSGI 标准(如 Gunicorn)
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
# 基础依赖
|
||||
Flask==3.1.0
|
||||
waitress==3.0.2
|
||||
gunicorn==20.0.4
|
||||
transformers==4.26.0
|
||||
|
||||
# 数据处理
|
||||
|
|
Loading…
Reference in New Issue