diff --git a/Dockerfile b/Dockerfile index e92ae9f..4807216 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,21 +1,15 @@ -FROM nvidia/cuda:12.2.0-runtime-ubuntu22.04 +FROM pytorch/pytorch:2.1.0-cuda12.1-cudnn8-runtime -ARG DEBIAN_FRONTEND=noninteractive ENV TZ=Asia/Shanghai -RUN apt-get update && \ - apt-get install --no-install-recommends -y python3 python3-pip python3-virtualenv && \ - apt-get install --no-install-recommends -y libopencv-dev python3-opencv && \ - rm -rf /var/lib/apt/lists/* +WORKDIR /app -ENV VIRTUAL_ENV=/opt/venv -RUN virtualenv $VIRTUAL_ENV -ENV PATH="$VIRTUAL_ENV/bin:$PATH" +COPY . /app -RUN pip install packaging +RUN pip install --no-cache-dir -r requirements.txt -WORKDIR /app +RUN pip install --no-cache-dir opencv-python-headless -COPY . /app/ +EXPOSE 8888 -CMD python3 main.py --host 0.0.0.0 --port 8888 +CMD ["python", "main.py", "--host", "0.0.0.0", "--port", "8888", "--skip-pip"] diff --git a/README.md b/README.md index 9640314..e07e12b 100644 --- a/README.md +++ b/README.md @@ -171,6 +171,14 @@ It will be persistent the dependent repositories and pip cache. You can add `-e PIP_INDEX_URL={pypi-mirror-url}` to docker run command to change pip index url. +> From version 0.4.0.0, Full environment include in docker image, mapping `models` or project root if you needed +> For example: +> ``` +> docker run -d --gpus all \ +> -v /Fooocus-API:/app \ +> -p 8888:8888 konieshadow/fooocus-api +>``` + # cmd flags - `-h, --help` show this help message and exit diff --git a/README_zh.md b/README_zh.md index fe935b1..9830b0b 100644 --- a/README_zh.md +++ b/README_zh.md @@ -169,6 +169,14 @@ docker run -d --gpus=all \ 你还可以添加 `-e PIP_INDEX_URL={pypi-mirror-url}` 选项来更换 pip 源 +> 0.4.0.0 版本开始,镜像包含完整运行环境,因此只需要根据需要将 `models` 或者项目根目录进行映射即可 +> 比如: +> ``` +> docker run -d --gpus all \ +> -v /Fooocus-API:/app \ +> -p 8888:8888 konieshadow/fooocus-api +>``` + # 命令行参数 - `-h, --help` 显示本帮助并退出 diff --git a/fooocus_api_version.py b/fooocus_api_version.py index a60c384..c22548b 100644 --- a/fooocus_api_version.py +++ b/fooocus_api_version.py @@ -1 +1 @@ -version = '0.4.0.0' +version = '0.4.0.1' diff --git a/fooocusapi/models/common/requests.py b/fooocusapi/models/common/requests.py index d97be78..5b898a7 100644 --- a/fooocusapi/models/common/requests.py +++ b/fooocusapi/models/common/requests.py @@ -1,7 +1,10 @@ """Common model for requests""" from typing import List -from pydantic import BaseModel, Field -from pydantic import ValidationError +from pydantic import ( + BaseModel, + Field, + ValidationError +) from modules.config import ( default_sampler, @@ -21,6 +24,7 @@ default_loras_model ) +default_aspect_ratio = default_aspect_ratio.split(" ")[0].replace("×", "*") class QueryJobRequest(BaseModel): """Query job request""" diff --git a/fooocusapi/parameters.py b/fooocusapi/parameters.py index 3f9d439..c61bef6 100644 --- a/fooocusapi/parameters.py +++ b/fooocusapi/parameters.py @@ -35,8 +35,8 @@ default_base_model_name = "juggernautXL_v8Rundiffusion.safetensors" default_refiner_model_name = "None" default_refiner_switch = 0.5 -default_loras = [["sd_xl_offset_example-lora_1.0.safetensors", 0.1]] -default_cfg_scale = 4.0 +default_loras = [[True, "sd_xl_offset_example-lora_1.0.safetensors", 0.1]] +default_cfg_scale = 7.0 default_prompt_negative = "" default_aspect_ratio = "1152*896" default_sampler = "dpmpp_2m_sde_gpu"