Skip to content

Commit

Permalink
Merge pull request #278 from mrhan1993:path
Browse files Browse the repository at this point in the history
patch, update dockerfile
  • Loading branch information
mrhan1993 authored Apr 8, 2024
2 parents 5acf0c8 + abb589d commit 98ac6c5
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 18 deletions.
20 changes: 7 additions & 13 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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"]
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 8 additions & 0 deletions README_zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -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` 显示本帮助并退出
Expand Down
2 changes: 1 addition & 1 deletion fooocus_api_version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
version = '0.4.0.0'
version = '0.4.0.1'
8 changes: 6 additions & 2 deletions fooocusapi/models/common/requests.py
Original file line number Diff line number Diff line change
@@ -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,
Expand All @@ -21,6 +24,7 @@
default_loras_model
)

default_aspect_ratio = default_aspect_ratio.split(" ")[0].replace("×", "*")

class QueryJobRequest(BaseModel):
"""Query job request"""
Expand Down
4 changes: 2 additions & 2 deletions fooocusapi/parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 98ac6c5

Please sign in to comment.