Skip to content

Commit 302f644

Browse files
committed
v0.4.0.6-Standalone
Update Release compatible with Fooocus-API v0.4.0.6 Changelog: - Fixed preview_stream and inpaint_preset for V1 endpoints - Updated and refractored code - Updated docs and added license See also [Fooocus-API changelog](https://github.com/mrhan1993/Fooocus-API/releases) to find out what's new in the API code and [Fooocus changelog](https://github.com/lllyasviel/Fooocus/releases) to see what's new in the included Fooocus version. This release is breaking some speed records on both cached and non-cached runs, surely give it it a try!
1 parent 64f4585 commit 302f644

File tree

9 files changed

+765
-220
lines changed

9 files changed

+765
-220
lines changed

Dockerfile

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,9 @@ COPY builder/clone.sh /clone.sh
66

77
# Clone the repos
88
# Fooocus-API
9-
RUN . /clone.sh /workspace https://github.com/mrhan1993/Fooocus-API.git 1c6eb9822564e43585591d137c4c117c5f100694
10-
# Fooocus
11-
RUN . /clone.sh /workspace/repositories/Fooocus https://github.com/lllyasviel/Fooocus.git e9bc5e50c6a9e9502e822d308cb370883c4ef202
9+
RUN . /clone.sh /workspace https://github.com/mrhan1993/Fooocus-API.git a50ed2f7db116f49e168c634ce4fa639ca42dda7
1210

13-
# Separate model stage to maintain build cache #
11+
# Separate model stage #
1412
# -------------------------------------------------------------------- #
1513
# You can use links with RUN wget or COPY to load files from your PC
1614
FROM alpine:3.19.1 as models
@@ -20,8 +18,6 @@ RUN apk add --no-cache wget
2018
#COPY your/path_relative_to_dockerfile/model.safetensors /workspace/repositories/Fooocus/models/checkpoints/destinationmodelname.safetensors
2119

2220
# These are all the models Fooocus needs by default (you can download them also from https://huggingface.co/3WaD/RunPod-Fooocus-API/tree/main)
23-
# sd_xl_offset_example-lora_1.0 can be found on stabilityai huggingface - https://huggingface.co/stabilityai/stable-diffusion-xl-base-1.0/tree/main and different checkpoint models can be obtained from Civitai
24-
# If you're changing those, don't forget to change what models are used by default in /src/config.txt and /src/default.json
2521
COPY models/juggernautXL_v8Rundiffusion.safetensors /workspace/repositories/Fooocus/models/checkpoints/juggernautXL_v8Rundiffusion.safetensors
2622
COPY models/sd_xl_offset_example-lora_1.0.safetensors /workspace/repositories/Fooocus/models/loras/sd_xl_offset_example-lora_1.0.safetensors
2723
COPY models/sdxl_lcm_lora.safetensors /workspace/repositories/Fooocus/models/loras/sdxl_lcm_lora.safetensors
@@ -66,7 +62,6 @@ RUN --mount=type=cache,target=/cache --mount=type=cache,target=/root/.cache/pip
6662
COPY --from=download /workspace/ /workspace/
6763
COPY --from=models /workspace/repositories/Fooocus/models /workspace/repositories/Fooocus/models
6864
# Change Fooocus configs
69-
COPY src/config.txt /workspace/repositories/Fooocus/config.txt
7065
COPY src/default.json /workspace/repositories/Fooocus/presets/default.json
7166

7267
# Install Python dependencies
@@ -84,4 +79,4 @@ RUN apt-get autoremove -y && \
8479
rm -rf /var/lib/apt/lists/*
8580

8681
RUN chmod +x /start.sh
87-
CMD /start.sh
82+
CMD /start.sh

LICENSE

Lines changed: 674 additions & 0 deletions
Large diffs are not rendered by default.

README.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
1-
![Static Badge](https://img.shields.io/badge/API_version-0.3.33-blue) ![Static Badge](https://img.shields.io/badge/API_coverage-100%25-vividgreen) ![Static Badge](https://img.shields.io/badge/API_tests-passed-vividgreen) ![Static Badge](https://img.shields.io/badge/Fooocus_version-2.3.0-lightgrey)
1+
![github-header](https://github.com/qodeindustries/Quinn-AI/assets/66263283/bf8149b2-cdc3-4a59-96fb-1d272221ef70)
2+
![Static Badge](https://img.shields.io/badge/API_version-0.4.0.6-blue) ![Static Badge](https://img.shields.io/badge/Fooocus_version-2.3.1-blue) ![Static Badge](https://img.shields.io/badge/API_coverage-100%25-vividgreen) ![Static Badge](https://img.shields.io/badge/API_tests-passed-vividgreen)
23

3-
# RunPod-Fooocus-API
4+
[Fooocus-API](https://github.com/mrhan1993/Fooocus-API) RunPod serverless worker implementation
5+
___
6+
Repository consists of two branches:
7+
[NetworkVolume](https://github.com/davefojtik/RunPod-Fooocus-API/tree/NetworkVolume) and [Standalone](https://github.com/davefojtik/RunPod-Fooocus-API/tree/Standalone)
48

5-
This repository consists of two branches:
6-
[NetworkVolume](https://github.com/davefojtik/RunPod-Fooocus-API/tree/NetworkVolume) and [Standalone](https://github.com/davefojtik/RunPod-Fooocus-API/tree/Standalone)
7-
8-
![image](https://github.com/davefojtik/RunPod-Fooocus-API/assets/66263283/88d74dd7-2dcd-44a8-af01-f1ce29bfb713)
9+
The **NetworkVolume** expects you to install and prepare your own instance on the RunPod network volume, or to use our `3wad/runpod-fooocus-api:0.4.0.6-networksetup` image for it. This is ideal if you want to change models, loras or other contents on the fly, let your users upload them, or persist generated image files. The downside of this solution is slower starts because everything has to be loaded over the datacenter's network. See [network-guide](https://github.com/davefojtik/RunPod-Fooocus-API/blob/NetworkVolume/docs/network-guide.md) for step-by-step instructions.
910

10-
11-
The **NetworkVolume** expects you to install and prepare your own `Fooocus-API v0.3.33` instance on the RunPod network volume, or to use our `3wad/runpod-fooocus-api:0.3.33-networksetup` image. This is ideal if you want to change models, loras or other contents on the fly. The downside of this solution is slower starts, especially when the endpoint is not used frequently. See [network-guide](https://github.com/davefojtik/RunPod-Fooocus-API/blob/NetworkVolume/docs/network-guide.md) for step-by-step instructions.
12-
13-
The **Standalone** branch is a ready-to-use docker image with all the files and models already baked and installed into it. You can still customize it to use your own content, but it can't be changed without rebuilding and redeploying the image. This is ideal if you want the fastest, cheapest possible endpoint for long-term usage without the need for frequent changes of models or loras. See [standalone-guide](https://github.com/davefojtik/RunPod-Fooocus-API/blob/Standalone/docs/standalone-guide.md) or simply use `3WaD/RunPod-Fooocus-API:v0.3.33-standalone` as the image for a quick deploy with the default Juggernaut V8 on your RunPod serverless endpoint.
11+
The **Standalone** branch is a ready-to-use docker image with all the files and models already baked and installed into it. You can still customize it to use your own content, but it can't be changed without rebuilding and redeploying the image. This is ideal if you want the fastest, cheapest possible endpoint for long-term usage without the need for frequent changes of its contents. See [standalone-guide](https://github.com/davefojtik/RunPod-Fooocus-API/blob/Standalone/docs/standalone-guide.md) or simply use `3WaD/runpod-fooocus-api:0.4.0.6-standalone` as the image for a quick deploy with the default Juggernaut V8 on your RunPod serverless endpoint.
1412

1513
## How to send requests
16-
[request_examples.js](https://github.com/davefojtik/RunPod-Fooocus-API/blob/NetworkVolume/docs/request_examples.js) contain example payloads for all endpoints on your serverless worker, regardless of the branch. But don't hesitate to ask if you need more help.
14+
[request_examples.js](https://github.com/davefojtik/RunPod-Fooocus-API/blob/Standalone/docs/request_examples.js) contain example payloads for all endpoints on your serverless worker, regardless of the branch. But don't hesitate to ask if you need more help.
1715

1816
## Contributors Welcomed
19-
Feel free to make pull requests, fixes, improvements and suggestions to the code. I can spend only limited time on this as it's only a side tool project for an AI Agent. So any cooperation will help manage this repo better.
17+
Feel free to make pull requests, fixes, improvements and suggestions to the code. Any cooperation on keeping this repo up-to-date and free of bugs is highly welcomed.
2018

2119
## Updates
22-
The version of compatible Fooocus-API is always stated at the top of this readme. We're not always on the latest version automatically, as there can be breaking changes. The updates are being made only after thorough tests on our community discord bot, and only if we see that the new version performs better or solves some problems.
20+
We're not always on the latest version automatically, as there can be breaking changes or major bugs. The updates are being made only after thorough tests by our community of Discord users generating images with the AI agent using this repo as it's tool. And only if we see that the new version performs better and stable.
21+
___
22+
> *Disclaimer: This repo is in no way affiliated with RunPod Inc. All logos and names are owned by the authors. This is an unofficial community implementation*

builder/requirements.txt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ pygit2==1.12.2
2222
opencv-contrib-python==4.8.0.74
2323
onnxruntime==1.16.3
2424
timm==0.9.2
25-
fastapi==0.103.1
25+
fastapi>=0.103.1
2626
pydantic==2.4.2
2727
pydantic_core==2.10.1
2828
python-multipart==0.0.6
@@ -31,4 +31,6 @@ colorlog
3131
requests
3232
numpy
3333
sqlalchemy
34-
packaging
34+
packaging
35+
rich
36+
chardet

docs/request_examples.js

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,8 @@ queryjob =
237237
}
238238
}
239239
// returns: {"delayTime": 0, "executionTime": 0,"id": "runpod-job-id","output": {"job_id": "fooocus-job-id", "job_type": "Text to Image", "job_stage": "WAITING", "job_progress": 0, "job_status": "string", "job_step_preview": "string", "job_result": [{"base64": "string","url": "string","seed": "string","finish_reason": "SUCCESS"}]},"status": "COMPLETED"}
240+
// NOTE: This endpoint, while working, does not make sense to be used on serverless. RunPod does not know which worker to send this request into.
241+
// YOU CAN USE ASYNC PREVIEW SENDING INSTEAD, SEE SECTION 3: CUSTOM PARAMS
240242

241243
// ----------------
242244
// **************************
@@ -248,6 +250,7 @@ jobqueue =
248250
}
249251
}
250252
// returns: {"delayTime": 0, "executionTime": 0,"id": "runpod-job-id","output": {"finished_size": 99,"last_job_id": "last-fooocus-job-id", "running_size": 0},"status": "COMPLETED"}
253+
// NOTE: This endpoint, while working, does not make sense to be used on serverless. RunPod does not know which worker to send this request into.
251254

252255
// ----------------
253256
// **************************
@@ -259,6 +262,7 @@ jobhistory =
259262
}
260263
}
261264
// returns: {"delayTime": 0, "executionTime": 0, "id":"runpod-job-id", 'output':{"queue": [],"history": []}, "status":"COMPLETED"}
265+
// NOTE: This endpoint, while working, does not make sense to be used on serverless. RunPod does not know which worker to send this request into.
262266

263267
// ----------------
264268
// **************************
@@ -270,6 +274,7 @@ stop =
270274
}
271275
}
272276
// returns: {"delayTime": 0, "executionTime": 0, "id":"runpod-job-id", 'output':{"msg": "success"}, "status":"COMPLETED"}
277+
// NOTE: This endpoint, while working, does not make sense to be used on serverless. RunPod does not know which worker to send this request into.
273278

274279
// ----------------
275280
// **************************
@@ -295,18 +300,6 @@ models =
295300
}
296301
// returns: {"delayTime": 0, "executionTime": 0, "id":"runpod-job-id", 'output':{"model_filenames": ["string"],"lora_filenames": ["string"]}, "status":"COMPLETED"}
297302

298-
// ----------------
299-
// **************************
300-
models_refresh =
301-
// **************************
302-
{
303-
"input":{
304-
"api_name":"models-refresh",
305-
}
306-
}
307-
// WARNING! This endpoint is deprecated! Features are merged into all-models endpoint. This endpoint will be removed in next releases!
308-
// returns: {"delayTime": 0, "executionTime": 0, "id":"runpod-job-id", 'output':{"model_filenames": ["string"],"lora_filenames": ["string"]}, "status":"COMPLETED"}
309-
310303
// ----------------
311304
// **************************
312305
styles =
@@ -334,8 +327,9 @@ v1 =
334327
"outpaint_selections":"Top,Bottom,Left,Right", // This param is special. It's expecting "Python Literals seperated by commas". That's why it's not a stringified array in this case.
335328
"outpaint_distance_left": "-1",
336329
"require_base64": "true",
337-
"style_selections": "[\"Fooocus V2\", \"Fooocus Enhance\", \"Fooocus Sharp\"]",
338-
"advanced_params": "{\"adaptive_cfg\":7}"
330+
"style_selections": "['Fooocus V2', 'Fooocus Enhance', 'Fooocus Sharp']",
331+
"advanced_params": "{'adaptive_cfg':'7'}",
332+
"preview_headers": "{\"Cookie\":\"foo=bar\"}"
339333
}
340334
}
341335

@@ -351,10 +345,15 @@ v2 =
351345
"style_selections": ["Fooocus V2", "Fooocus Enhance", "Fooocus Sharp"],
352346
"advanced_params": {
353347
"adaptive_cfg":7
354-
}
348+
},
349+
"preview_headers": {"Cookie":"foo=bar"}
355350
}
356351
}
357352

353+
// To see the full Fooocus-API params documentation, please refer to:
354+
// https://github.com/mrhan1993/Fooocus-API/blob/a50ed2f7db116f49e168c634ce4fa639ca42dda7/docs/api_doc_en.md
355+
356+
358357
// ----------------------------------------------------
359358
// 3: Custom params
360359
// ----------------------------------------------------
@@ -365,5 +364,6 @@ v2 =
365364
"preview_url" // "string" - If you use Fooocus-API "async_process:true" and want to get a stream of preview images, you should add your app's url endpoint where POST requests with previews will arrive
366365
"preview_interval" // "number" - Optional param when using preview_url, sets how often in seconds the preview is checked and sent to your app. If not set defaults to 1
367366
"preview_headers" // "object" - Optional param when using preview_url, sets custom headers to send with the preview request (for tokens, auth etc.)
367+
// preview_headers should be json containing header and it's value, in V1 endpoints format them like this: "{\"Cookie\":\"foo=bar\"}"
368368
"inpaint_preset" // "string" - Custom fix for missing "Inpaint Method" selection in Fooocus-API. Can be one of: 'Improve Detail', 'Modify Content' or 'Inpaint or Outpaint'
369369
"clear_output" // "boolean" - Chooses if you want to keep the image files on network volume/worker local storage or not. Can be true or false. Default is true (not saving image files)

docs/standalone-guide.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
## How to use standalone image
2-
- [**Create RunPod serverless endpoint:**](https://www.runpod.io/console/serverless) use `3wad/runpod-fooocus-api:0.3.33-standalone`
2+
- [**Create RunPod serverless endpoint:**](https://www.runpod.io/console/serverless) use `3wad/runpod-fooocus-api:0.4.0.6-standalone`
33
- Other settings are your choice, but I personally found that using 4090/L4 GPUs + Flashboot is the most cost-effective one.
4-
- That's it! See the [request_examples]() for how to make requests to this endpoint from your app.
4+
- That's it! See the [request_examples](https://github.com/davefojtik/RunPod-Fooocus-API/blob/Standalone/docs/request_examples.js) for how to make requests to this endpoint from your app.
55

66
## How to customize standalone image
7-
To modify default settings and model, see [config.txt](https://github.com/davefojtik/RunPod-Fooocus-API/Standalone/src/config.txt) and [default.json](https://github.com/davefojtik/RunPod-Fooocus-API/Standalone/src/default.json)
8-
To modify which models and files are being baked into the image, see [Dockerfile](https://github.com/davefojtik/RunPod-Fooocus-API/Standalone/Dockerfile)
7+
To modify default settings and model, see [default.json](https://github.com/davefojtik/RunPod-Fooocus-API/blob/Standalone/src/default.json)
8+
To modify which models and files are being baked into the image, see [Dockerfile](https://github.com/davefojtik/RunPod-Fooocus-API/blob/Standalone/Dockerfile)

src/config.txt

Lines changed: 0 additions & 121 deletions
This file was deleted.

0 commit comments

Comments
 (0)