mirror of
https://github.com/Refound-445/nonebot-plugin-nailongremove.git
synced 2025-11-04 21:22:43 +08:00
up
This commit is contained in:
parent
12fdb6ebc6
commit
4bf8af3c7f
@ -175,6 +175,10 @@ plugins = [
|
||||
|
||||
## 📝 更新日志
|
||||
|
||||
### 2.1.0
|
||||
|
||||
- 从原仓库下载模型
|
||||
|
||||
### 2.0.0
|
||||
|
||||
- 重构插件,适配多平台
|
||||
|
||||
@ -9,7 +9,7 @@ require("nonebot_plugin_uninfo")
|
||||
from . import handler as handler
|
||||
from .config import Config
|
||||
|
||||
__version__ = "2.0.0.post1"
|
||||
__version__ = "2.1.0"
|
||||
__plugin_meta__ = PluginMetadata(
|
||||
name="自动撤回奶龙",
|
||||
description="一个基于图像分类模型的简单插件~",
|
||||
|
||||
@ -1,15 +1,29 @@
|
||||
from typing import NoReturn
|
||||
|
||||
from nonebot.utils import run_sync
|
||||
|
||||
from ..config import ModelType, config
|
||||
|
||||
|
||||
def raise_extra_import_error(e: BaseException, group: str) -> NoReturn:
|
||||
raise ImportError(
|
||||
f"Possibly missing required libraries, "
|
||||
f"Please run `pip install nonebot-plugin-nailongremove[{group}]` "
|
||||
f"in your project's environment to install.",
|
||||
) from e
|
||||
|
||||
|
||||
if config.nailong_model is ModelType.CLASSIFICATION:
|
||||
from .classification import check_image as original_check_image
|
||||
from .classification import check_image as check_image_sync
|
||||
|
||||
elif config.nailong_model is ModelType.TARGET_DETECTION:
|
||||
from .target_detection import check_image as original_check_image
|
||||
try:
|
||||
from .target_detection import check_image as check_image_sync
|
||||
except ImportError as e:
|
||||
raise_extra_import_error(e, "model1")
|
||||
|
||||
else:
|
||||
raise ValueError("Invalid model type")
|
||||
|
||||
|
||||
check_image = run_sync(original_check_image)
|
||||
check_image = run_sync(check_image_sync)
|
||||
|
||||
@ -82,6 +82,8 @@ def ensure_model(
|
||||
return model_path
|
||||
|
||||
def download():
|
||||
if not config.nailong_model_dir.exists():
|
||||
config.nailong_model_dir.mkdir(parents=True)
|
||||
url = f"{model_base_url}/{model_filename}"
|
||||
torch.hub.download_url_to_file(url, str(model_path), progress=True)
|
||||
|
||||
|
||||
24
pdm.lock
generated
24
pdm.lock
generated
@ -2,10 +2,10 @@
|
||||
# It is not intended for manual editing.
|
||||
|
||||
[metadata]
|
||||
groups = ["default", "dev"]
|
||||
groups = ["default", "dev", "model1"]
|
||||
strategy = ["inherit_metadata"]
|
||||
lock_version = "4.5.0"
|
||||
content_hash = "sha256:7868b60c31ed011223f0659050843d0ef03b22491ed12abca51f36319931e400"
|
||||
content_hash = "sha256:efbb65911830ebd164f997b84aa18287a26ffccd24d5b8b0dfd728997d8f527f"
|
||||
|
||||
[[metadata.targets]]
|
||||
requires_python = "~=3.9"
|
||||
@ -298,7 +298,7 @@ name = "coloredlogs"
|
||||
version = "15.0.1"
|
||||
requires_python = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*"
|
||||
summary = "Colored terminal output for Python's logging module"
|
||||
groups = ["default"]
|
||||
groups = ["model1"]
|
||||
dependencies = [
|
||||
"humanfriendly>=9.1",
|
||||
]
|
||||
@ -350,7 +350,7 @@ files = [
|
||||
name = "flatbuffers"
|
||||
version = "24.3.25"
|
||||
summary = "The FlatBuffers serialization format for Python"
|
||||
groups = ["default"]
|
||||
groups = ["model1"]
|
||||
files = [
|
||||
{file = "flatbuffers-24.3.25-py2.py3-none-any.whl", hash = "sha256:8dbdec58f935f3765e4f7f3cf635ac3a77f83568138d6a2311f524ec96364812"},
|
||||
{file = "flatbuffers-24.3.25.tar.gz", hash = "sha256:de2ec5b203f21441716617f38443e0a8ebf3d25bf0d9c0bb0ce68fa00ad546a4"},
|
||||
@ -625,7 +625,7 @@ name = "humanfriendly"
|
||||
version = "10.0"
|
||||
requires_python = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*"
|
||||
summary = "Human friendly output for text interfaces using Python"
|
||||
groups = ["default"]
|
||||
groups = ["model1"]
|
||||
dependencies = [
|
||||
"monotonic; python_version == \"2.7\"",
|
||||
"pyreadline3; sys_platform == \"win32\" and python_version >= \"3.8\"",
|
||||
@ -855,7 +855,7 @@ files = [
|
||||
name = "mpmath"
|
||||
version = "1.3.0"
|
||||
summary = "Python library for arbitrary-precision floating-point arithmetic"
|
||||
groups = ["default"]
|
||||
groups = ["default", "model1"]
|
||||
files = [
|
||||
{file = "mpmath-1.3.0-py3-none-any.whl", hash = "sha256:a0b2b9fe80bbcd81a6647ff13108738cfb482d481d826cc0e02f5b35e5c88d2c"},
|
||||
{file = "mpmath-1.3.0.tar.gz", hash = "sha256:7a28eb2a9774d00c7bc92411c19a89209d5da7c4c9a9e227be8330a23a25b91f"},
|
||||
@ -1309,7 +1309,7 @@ name = "numpy"
|
||||
version = "2.0.2"
|
||||
requires_python = ">=3.9"
|
||||
summary = "Fundamental package for array computing in Python"
|
||||
groups = ["default"]
|
||||
groups = ["default", "model1"]
|
||||
files = [
|
||||
{file = "numpy-2.0.2-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:51129a29dbe56f9ca83438b706e2e69a39892b5eda6cedcb6b0c9fdc9b0d3ece"},
|
||||
{file = "numpy-2.0.2-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:f15975dfec0cf2239224d80e32c3170b1d168335eaedee69da84fbe9f1f9cd04"},
|
||||
@ -1529,7 +1529,7 @@ files = [
|
||||
name = "onnxruntime"
|
||||
version = "1.19.2"
|
||||
summary = "ONNX Runtime is a runtime accelerator for Machine Learning models"
|
||||
groups = ["default"]
|
||||
groups = ["model1"]
|
||||
dependencies = [
|
||||
"coloredlogs",
|
||||
"flatbuffers",
|
||||
@ -1677,7 +1677,7 @@ name = "packaging"
|
||||
version = "24.1"
|
||||
requires_python = ">=3.8"
|
||||
summary = "Core utilities for Python packages"
|
||||
groups = ["default", "dev"]
|
||||
groups = ["default", "dev", "model1"]
|
||||
files = [
|
||||
{file = "packaging-24.1-py3-none-any.whl", hash = "sha256:5b8f2217dbdbd2f7f384c41c628544e6d52f2d0f53c6d0c3ea61aa5d1d7ff124"},
|
||||
{file = "packaging-24.1.tar.gz", hash = "sha256:026ed72c8ed3fcce5bf8950572258698927fd1dbda10a5e981cdf0ac37f4f002"},
|
||||
@ -1863,7 +1863,7 @@ name = "protobuf"
|
||||
version = "5.28.3"
|
||||
requires_python = ">=3.8"
|
||||
summary = ""
|
||||
groups = ["default"]
|
||||
groups = ["model1"]
|
||||
files = [
|
||||
{file = "protobuf-5.28.3-cp310-abi3-win32.whl", hash = "sha256:0c4eec6f987338617072592b97943fdbe30d019c56126493111cf24344c1cc24"},
|
||||
{file = "protobuf-5.28.3-cp310-abi3-win_amd64.whl", hash = "sha256:91fba8f445723fcf400fdbe9ca796b19d3b1242cd873907979b9ed71e4afe868"},
|
||||
@ -2036,7 +2036,7 @@ name = "pyreadline3"
|
||||
version = "3.5.4"
|
||||
requires_python = ">=3.8"
|
||||
summary = "A python implementation of GNU readline."
|
||||
groups = ["default"]
|
||||
groups = ["model1"]
|
||||
marker = "sys_platform == \"win32\" and python_version >= \"3.8\""
|
||||
files = [
|
||||
{file = "pyreadline3-3.5.4-py3-none-any.whl", hash = "sha256:eaf8e6cc3c49bcccf145fc6067ba8643d1df34d604a1ec0eccbf7a18e6d3fae6"},
|
||||
@ -2182,7 +2182,7 @@ name = "sympy"
|
||||
version = "1.13.1"
|
||||
requires_python = ">=3.8"
|
||||
summary = "Computer algebra system (CAS) in Python"
|
||||
groups = ["default"]
|
||||
groups = ["default", "model1"]
|
||||
dependencies = [
|
||||
"mpmath<1.4,>=1.1.0",
|
||||
]
|
||||
|
||||
@ -9,15 +9,14 @@ authors = [
|
||||
requires-python = "<4.0,>=3.9"
|
||||
dependencies = [
|
||||
"nonebot2>=2.2.0",
|
||||
"nonebot-plugin-alconna>=0.53.1",
|
||||
"nonebot-plugin-uninfo>=0.5.0",
|
||||
"opencv-python>=4.5",
|
||||
"numpy>=1.19",
|
||||
"keras>=2.4",
|
||||
"pillow>=9",
|
||||
"torch>=2.4",
|
||||
"torchvision>=0.19",
|
||||
"nonebot-plugin-alconna>=0.53.1",
|
||||
"nonebot-plugin-uninfo>=0.5.0",
|
||||
"onnxruntime>=1.19.2",
|
||||
"cookit>=0.8.1",
|
||||
"httpx>=0.27.2",
|
||||
"githubkit>=0.11.14",
|
||||
@ -30,6 +29,9 @@ keywords = ["nonebot", "plugin", "image"]
|
||||
homepage = "https://github.com/Refound-445/onoebot-plugin-nailongremove"
|
||||
repository = "https://github.com/Refound-445/onoebot-plugin-nailongremove"
|
||||
|
||||
[project.optional-dependencies]
|
||||
model1 = ["onnxruntime>=1.19.2"]
|
||||
|
||||
[build-system]
|
||||
requires = ["pdm-backend"]
|
||||
build-backend = "pdm.backend"
|
||||
|
||||
Loading…
Reference in New Issue
Block a user