From 04798945d2ae884ab366accda5b31a775df43a75 Mon Sep 17 00:00:00 2001 From: EdgeNeko Date: Tue, 7 May 2024 00:44:45 +0800 Subject: [PATCH] prevent check if the static directory exists while add static middleware --- .idea/inspectionProfiles/profiles_settings.xml | 6 ------ app/webapp.py | 4 +++- download-model.Dockerfile | 13 ------------- 3 files changed, 3 insertions(+), 20 deletions(-) delete mode 100644 .idea/inspectionProfiles/profiles_settings.xml delete mode 100644 download-model.Dockerfile diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml deleted file mode 100644 index 105ce2d..0000000 --- a/.idea/inspectionProfiles/profiles_settings.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - \ No newline at end of file diff --git a/app/webapp.py b/app/webapp.py index 0a3df94..7f283ae 100644 --- a/app/webapp.py +++ b/app/webapp.py @@ -42,7 +42,9 @@ async def lifespan(_: FastAPI): app.include_router(admin_controller.admin_router, prefix="/admin") if config.storage.method == "local": - app.mount("/static", StaticFiles(directory=pathlib.Path(config.storage.local.path)), name="static") + # Since we will check & create the static directory soon later when the StorageService initialized, we don't need to + # check it here. + app.mount("/static", StaticFiles(directory=pathlib.Path(config.storage.local.path), check_dir=False), name="static") @app.get("/", description="Default portal. Test for server availability.") diff --git a/download-model.Dockerfile b/download-model.Dockerfile deleted file mode 100644 index 029fb20..0000000 --- a/download-model.Dockerfile +++ /dev/null @@ -1,13 +0,0 @@ -FROM edgeneko/neko-image-gallery:latest - -RUN mkdir -p /opt/models && \ - huggingface-cli download openai/clip-vit-large-patch14 model.safetensors *.txt *.json --local-dir /opt/models/clip && \ - huggingface-cli download google-bert/bert-base-chinese model.safetensors *.txt *.json --local-dir /opt/models/bert && \ - huggingface-cli download pk5ls20/PaddleModel PaddleOCR2Pytorch/ch_ptocr_v4_det_infer.pth PaddleOCR2Pytorch/ch_ptocr_v4_rec_infer.pth \ - PaddleOCR2Pytorch/ch_ptocr_mobile_v2.0_cls_infer.pth PaddleOCR2Pytorch/configs/det/ch_PP-OCRv4/ch_PP-OCRv4_det_student.yml \ - PaddleOCR2Pytorch/configs/rec/PP-OCRv4/ch_PP-OCRv4_rec.yml ppocr_keys_v1.txt --local-dir /opt/models/paddleocr && \ - rm -rf /root/.cache/huggingface - -ENV APP_MODEL__CLIP=/opt/models/clip -ENV APP_MODEL__BERT=/opt/models/bert -ENV APP_MODEL__EASYPADDLEOCR=/opt/models/ocr \ No newline at end of file