mirror of
https://github.com/luguoyixiazi/test_nine.git
synced 2025-12-06 14:52:49 +08:00
改一下多平台适配
This commit is contained in:
3
main.py
3
main.py
@@ -15,13 +15,14 @@ from predict import predict_onnx,predict_onnx_pdl,predict_onnx_dfine
|
||||
from crop_image import crop_image_v3,save_path,save_fail_path,save_pass_path,validate_path
|
||||
|
||||
PORT = 9645
|
||||
platform = os.name
|
||||
# --- 日志配置字典 ---
|
||||
LOGGING_CONFIG = {
|
||||
"version": 1,
|
||||
"disable_existing_loggers": False,
|
||||
"formatters": {
|
||||
"default": {
|
||||
"()": "uvicorn._logging.DefaultFormatter",
|
||||
"()": f"uvicorn.{'_logging' if platform== 'nt' else 'logging'}.DefaultFormatter",
|
||||
"fmt": "%(levelprefix)s %(asctime)s | %(message)s",
|
||||
"datefmt": "%Y-%m-%d %H:%M:%S",
|
||||
},
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import os
|
||||
import numpy as np
|
||||
from train import MyResNet18, data_transform
|
||||
from crop_image import crop_image, convert_png_to_jpg,draw_points_on_image,bytes_to_pil,validate_path
|
||||
import time
|
||||
from PIL import Image, ImageDraw
|
||||
@@ -10,6 +9,7 @@ import onnxruntime as ort
|
||||
|
||||
def predict(icon_image, bg_image):
|
||||
import torch
|
||||
from train import MyResNet18, data_transform
|
||||
current_dir = os.path.dirname(os.path.abspath(__file__))
|
||||
model_path = os.path.join(current_dir, 'model', 'resnet18_38_0.021147585306924.pth')
|
||||
coordinates = [
|
||||
|
||||
Reference in New Issue
Block a user