luoyulong 2 роки тому
батько
коміт
93d6302cb0
5 змінених файлів з 10 додано та 6 видалено
  1. 1 1
      Dockerfile
  2. 2 2
      docker-compose.yml
  3. 6 3
      server.py
  4. 1 0
      sx_utils/__init__.py
  5. 0 0
      sx_utils/webutil.py

+ 1 - 1
Dockerfile

@@ -91,7 +91,7 @@ startretries=0\n\
 redirect_stderr=true\n\
 stdout_logfile=/var/log/be.log\n\
 stdout_logfile_maxbytes=50MB\n\
-environment=CUDA_VISIBLE_DEVICES=0\n\
+environment=CUDA_VISIBLE_DEVICES=0,PYTHONPATH=/worksapce/yolov5\n\
 " > /etc/supervisor/conf.d/be.conf
 
 RUN git clone https://gitee.com/monkeycc/yolov5.git

+ 2 - 2
docker-compose.yml

@@ -11,8 +11,8 @@ services:
     working_dir: /workspace
     ports:
       - '18089:8080'
-    volumes:
-      - ./:/workspace
+    # volumes:
+    #   - ./:/workspace
     # deploy:
     #   resources:
     #     reservations:

+ 6 - 3
server.py

@@ -2,7 +2,7 @@ from fastapi import FastAPI, Request, Form, File, UploadFile
 from fastapi.templating import Jinja2Templates
 from pydantic import BaseModel
 from typing import List, Optional
-from utils.webutil import web_try
+from sx_utils import web_try
 import cv2
 import numpy as np
 
@@ -10,9 +10,12 @@ import torch
 import base64
 import random
 
-YOLO_DIR = '/workspace/yolov5'
+# YOLO_DIR = '/workspace/yolov5'
+YOLO_DIR = '/Users/sxkj/opt/python-workspace/yili-ocr/yl-ocr-layout/yolov5'
 # WEIGHTS = '/data/yolov5/runs/train/yolov5x_layout_reuslt37/weights/best.pt'
-WEIGHTS = '/workspace/best.pt'
+# WEIGHTS = '/workspace/best.pt'
+WEIGHTS = '/Users/sxkj/opt/python-workspace/yili-ocr/yl-ocr-layout/best.pt'
+
 device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
 
 

+ 1 - 0
sx_utils/__init__.py

@@ -0,0 +1 @@
+from sx_utils.webutil import *

+ 0 - 0
utils/webutil.py → sx_utils/webutil.py