luoyulong vor 2 Jahren
Ursprung
Commit
93d6302cb0
5 geänderte Dateien mit 10 neuen und 6 gelöschten Zeilen
  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\
 redirect_stderr=true\n\
 stdout_logfile=/var/log/be.log\n\
 stdout_logfile=/var/log/be.log\n\
 stdout_logfile_maxbytes=50MB\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
 " > /etc/supervisor/conf.d/be.conf
 
 
 RUN git clone https://gitee.com/monkeycc/yolov5.git
 RUN git clone https://gitee.com/monkeycc/yolov5.git

+ 2 - 2
docker-compose.yml

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

+ 6 - 3
server.py

@@ -2,7 +2,7 @@ from fastapi import FastAPI, Request, Form, File, UploadFile
 from fastapi.templating import Jinja2Templates
 from fastapi.templating import Jinja2Templates
 from pydantic import BaseModel
 from pydantic import BaseModel
 from typing import List, Optional
 from typing import List, Optional
-from utils.webutil import web_try
+from sx_utils import web_try
 import cv2
 import cv2
 import numpy as np
 import numpy as np
 
 
@@ -10,9 +10,12 @@ import torch
 import base64
 import base64
 import random
 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 = '/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")
 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