Skip to content

Commit f3c778f

Browse files
committed
move out save_final_enhanced_image_only from adv_params
update version update doc
1 parent 00c1f41 commit f3c778f

9 files changed

+41
-33
lines changed

Diff for: README.md

-11
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,6 @@
1919
- [License](#license)
2020
- [Thanks :purple\_heart:](#thanks-purple_heart)
2121

22-
If this is the first time to use it, it is recommended to use a rewritten new project [FooocusAPI](https://github.com/mrhan1993/FooocusAPI)
23-
24-
A migration guide is provided [here](./docs/migrate.md).
25-
26-
# :warning: Compatibility warning :warning:
27-
28-
When upgrading from version 3.x to version 4.0, please read the following incompatibility notes:
29-
30-
1. If you are using an external Fooocus model (that is, the model is not located in the `repositories` directory), delete the `repositories` directory directly, and then update the `git pull`.
31-
2. If not, move the `repositories` directory to any directory, delete the `repositories` directory, then update the `git pull`, and move the `models` directory back to its original location when it is finished.
32-
3322
# Introduction
3423

3524
FastAPI powered API for [Fooocus](https://github.com/lllyasviel/Fooocus).

Diff for: README_zh.md

+1-12
Original file line numberDiff line numberDiff line change
@@ -19,22 +19,11 @@
1919
- [License](#license)
2020
- [感谢 :purple\_heart:](#感谢-purple_heart)
2121

22-
如果是第一次使用,推荐使用重写后的新项目 [FooocusAPI](https://github.com/mrhan1993/FooocusAPI)
23-
24-
我还准备了一个[迁移指南](./docs/migrate_zh.md)
25-
26-
# :warning: 兼容性警告 :warning:
27-
28-
如果是从 0.3.x 版本升级到 0.4.0 版本,请务必阅读以下兼容性说明:
29-
30-
1. 如果你使用的是外部 Fooocus 模型(即模型不是位于 `repositories/Fooocus/models` 目录下),直接删除 `repositories` 目录,然后执行 `git pull` 更新即可
31-
2. 如果不是上述方式,将 `repositories/Fooocus/models` 目录移动到任意目录,删除 `repositories` 目录,然后执行 `git pull` 更新,完成后将 `models` 目录移动回原位置
32-
3322
# 简介
3423

3524
使用 FastAPI 构建的 [Fooocus](https://github.com/lllyasviel/Fooocus) 的 API。
3625

37-
当前支持的 Fooocus 版本: [2.3.1](https://github.com/lllyasviel/Fooocus/blob/main/update_log.md)
26+
当前支持的 Fooocus 版本: [2.5.3](https://github.com/lllyasviel/Fooocus/blob/main/update_log.md)
3827

3928
## Fooocus
4029

Diff for: docs/change_logs.md

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
# ChangeLog for Fooocus-API
22

3-
## [UNRELEASE]
3+
## [v0.5.0.1]
44
### Changed
5+
- Fooocus to v2.5.3
6+
- Add enhance image endpoint
7+
- Add generate mask endpoint
8+
- Influenced by Fooocus, the worker.py was reconstructed
59
- Update docs
6-
- Returnd base64 str now include identifier like this `data:image/jpeg;base64,`
10+
- Returned base64 str now include identifier like this `data:image/jpeg;base64,`
711

812
### Fixed
913
- Issue #375

Diff for: docs/change_logs_zh.md

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
# ChangeLog for Fooocus-API
22

3-
## [UNRELEASE]
3+
## [v0.5.0.1]
44
### Changed
5+
- 合并到 Fooocus 2.5.3
6+
- 增加图像增强接口
7+
- 增加遮罩生成接口
8+
- 受 Fooocus 影响,重构了 worker.py
59
- 更新文档
610
- 返回数据中的 base64 字符串现在包含图像标识符,比如 `data:image/jpeg;base64,`
711

Diff for: fooocus_api_version.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
version = '0.4.1.1'
1+
version = '0.5.0.1'

Diff for: fooocusapi/parameters.py

+2
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ def __init__(
3838
enhance_uov_method: str,
3939
enhance_uov_processing_order,
4040
enhance_uov_prompt_type,
41+
save_final_enhanced_image_only,
4142
enhance_ctrlnets: List[EnhanceCtrlNets],
4243
image_prompts: List[Tuple[np.ndarray, float, float, str]],
4344
read_wildcards_in_order: bool,
@@ -77,6 +78,7 @@ def __init__(
7778
self.enhance_uov_method = enhance_uov_method
7879
self.enhance_uov_processing_order = enhance_uov_processing_order
7980
self.enhance_uov_prompt_type = enhance_uov_prompt_type
81+
self.save_final_enhanced_image_only = save_final_enhanced_image_only
8082
self.enhance_ctrlnets = enhance_ctrlnets[:config.default_enhance_tabs] if len(enhance_ctrlnets) > config.default_enhance_tabs else enhance_ctrlnets
8183
self.current_tab = None
8284
self.read_wildcards_in_order = read_wildcards_in_order

Diff for: fooocusapi/sql_client.py

+9
Original file line numberDiff line numberDiff line change
@@ -285,12 +285,21 @@ def add_history(
285285
params["result_url"] = result_url
286286
params["finish_reason"] = finish_reason
287287

288+
del params["enhance_input_image"]
289+
del params["enhance_checkbox"]
290+
del params["enhance_uov_method"]
291+
del params["enhance_uov_processing_order"]
292+
del params["enhance_uov_prompt_type"]
293+
del params["save_final_enhanced_image_only"]
294+
del params["enhance_ctrlnets"]
288295
del params["inpaint_input_image"]
289296
del params["uov_input_image"]
290297
del params["save_extension"]
291298
del params["save_meta"]
292299
del params["save_name"]
293300
del params["meta_scheme"]
301+
del params["read_wildcards_in_order"]
302+
del params["current_tab"]
294303

295304
db.store_history(params)
296305

Diff for: fooocusapi/utils/api_utils.py

+16-5
Original file line numberDiff line numberDiff line change
@@ -186,11 +186,21 @@ def req_to_params(req: Text2ImgRequest) -> ImageGenerationParams:
186186
dp = (None, 0.5, 0.6, 'ImagePrompt')
187187
image_prompts += [dp] * (config.default_controlnet_image_count - len(image_prompts))
188188

189-
enhance_input_image = None if not isinstance(req, (ImageEnhanceRequest, ImageEnhanceRequestJson)) else read_input_image(req.enhance_input_image)
190-
enhance_checkbox = True
191-
enhance_uov_method = flags.disabled if not isinstance(req, (ImageEnhanceRequest, ImageEnhanceRequestJson)) else req.enhance_uov_method
192-
enhance_uov_processing_order = "Before First Enhancement" if not isinstance(req, (ImageEnhanceRequest, ImageEnhanceRequestJson)) else req.enhance_uov_processing_order
193-
enhance_uov_prompt_type = "Original Prompts" if not isinstance(req, (ImageEnhanceRequest, ImageEnhanceRequestJson)) else req.enhance_uov_prompt_type
189+
if isinstance(req, (ImageEnhanceRequest, ImageEnhanceRequestJson)):
190+
enhance_checkbox = True
191+
enhance_input_image = read_input_image(req.enhance_input_image)
192+
enhance_uov_method = req.enhance_uov_method
193+
enhance_uov_processing_order = req.enhance_uov_processing_order
194+
enhance_uov_prompt_type = req.enhance_uov_prompt_type
195+
save_final_enhanced_image_only = True
196+
else:
197+
enhance_checkbox = False
198+
enhance_input_image = None
199+
enhance_uov_method = flags.disabled
200+
enhance_uov_processing_order = "Before First Enhancement"
201+
enhance_uov_prompt_type = "Original Prompts"
202+
save_final_enhanced_image_only = False
203+
194204
if not isinstance(req, (ImageEnhanceRequest, ImageEnhanceRequestJson)):
195205
enhance_ctrlnets = [EnhanceCtrlNets()] * config.default_enhance_tabs
196206
else:
@@ -247,6 +257,7 @@ def req_to_params(req: Text2ImgRequest) -> ImageGenerationParams:
247257
enhance_uov_method=enhance_uov_method,
248258
enhance_uov_processing_order=enhance_uov_processing_order,
249259
enhance_uov_prompt_type=enhance_uov_prompt_type,
260+
save_final_enhanced_image_only=save_final_enhanced_image_only,
250261
enhance_ctrlnets=enhance_ctrlnets,
251262
read_wildcards_in_order=req.read_wildcards_in_order,
252263
image_prompts=image_prompts,

Diff for: fooocusapi/worker.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ def __init__(self, args: ImageGenerationParams):
124124
self.inpaint_advanced_masking_checkbox = adp.inpaint_advanced_masking_checkbox
125125
self.invert_mask_checkbox = adp.invert_mask_checkbox
126126
self.inpaint_erode_or_dilate = adp.inpaint_erode_or_dilate
127-
self.save_final_enhanced_image_only = adp.save_final_enhanced_image_only if not args_manager.args.disable_image_log else False
127+
self.save_final_enhanced_image_only = args.save_final_enhanced_image_only if not args_manager.args.disable_image_log else False
128128
self.save_metadata_to_images = args.save_meta
129129
self.metadata_scheme = MetadataScheme(
130130
args.meta_scheme) if not args_manager.args.disable_metadata else MetadataScheme.FOOOCUS

0 commit comments

Comments
 (0)