Skip to content

Commit

Permalink
合并拉取请求 #33
Browse files Browse the repository at this point in the history
merge v2.5.2
  • Loading branch information
mrhan1993 authored Aug 1, 2024
2 parents 36c06bf + ab225d5 commit 14b2eca
Show file tree
Hide file tree
Showing 16 changed files with 296 additions and 132 deletions.
6 changes: 3 additions & 3 deletions .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ body:
description: |
Please perform basic debugging to see if your configuration is the cause of the issue.
Basic debug procedure
 2. Update Fooocus - sometimes things just need to be updated
 3. Backup and remove your config.txt - check if the issue is caused by bad configuration
 5. Try a fresh installation of Fooocus in a different directory - see if a clean installation solves the issue
 1. Update Fooocus - sometimes things just need to be updated
 2. Backup and remove your config.txt - check if the issue is caused by bad configuration
 3. Try a fresh installation of Fooocus in a different directory - see if a clean installation solves the issue
Before making a issue report please, check that the issue hasn't been reported recently.
options:
- label: The issue has not been resolved by following the [troubleshooting guide](https://github.com/lllyasviel/Fooocus/blob/main/troubleshoot.md)
Expand Down
1 change: 1 addition & 0 deletions apis/models/requests.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ class CommonRequest(BaseModel):
inpaint_advanced_masking_checkbox: bool = Field(default=False, description="Inpaint Advanced Masking Checkbox")
invert_mask_checkbox: bool = Field(default=False, description="Inpaint Invert Mask Checkbox")
inpaint_erode_or_dilate: int = Field(default=0, ge=-64, le=64, description="Inpaint Erode or Dilate")
save_final_enhanced_image_only: bool = Field(default=False, description="Save final enhanced image only")
save_metadata_to_images: bool = Field(default=True, description="Save meta data")
metadata_scheme: MetadataScheme = Field(default=MetadataScheme.FOOOCUS, description="Meta data scheme, one of [fooocus, a111]")
controlnet_image: List[ImagePrompt] = Field(default=[ImagePrompt()], description="ControlNet Image Prompt")
Expand Down
7 changes: 7 additions & 0 deletions apis/routes/query.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Query routes.
"""
import os
import re
import json

Expand Down Expand Up @@ -154,6 +155,9 @@ async def get_output(dir_name: str, file_name: str, accept: str = Header(None)):
"""
Get a specific output by its ID.
"""
if not os.path.exists(f"{path_outputs}/{dir_name}/{file_name}"):
return Response(status_code=404)

accept_formats = ('png', 'jpg', 'jpeg', 'webp')
try:
_, ext = accept.lower().split("/")
Expand All @@ -179,6 +183,9 @@ async def get_input(file_name: str, accept: str = Header(None)):
"""
Get a specific input by its ID.
"""
if not os.path.exists(f"inputs/{file_name}"):
return Response(status_code=404)

accept_formats = ('png', 'jpg', 'jpeg', 'webp')
try:
_, ext = accept.lower().split("/")
Expand Down
1 change: 1 addition & 0 deletions apis/utils/api_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ def params_to_params(req: object) -> list:
req.inpaint_advanced_masking_checkbox,
req.invert_mask_checkbox,
req.inpaint_erode_or_dilate,
req.save_final_enhanced_image_only,

req.save_metadata_to_images,
req.metadata_scheme.value,
Expand Down
9 changes: 8 additions & 1 deletion apis/utils/post_worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from apis.utils.sql_client import GenerateRecord
from apis.utils.web_hook import send_result_to_web_hook
from modules.async_worker import AsyncTask
from modules.config import path_outputs
from modules.config import path_outputs, temp_path


ROOT_DIR = file_utils.SCRIPT_PATH
Expand All @@ -37,7 +37,14 @@ async def post_worker(task: AsyncTask, started_at: int, target_name: str, ext: s
:param ext:
:return: The task.
"""
final_enhanced = []
task_status = "finished"
if task.save_final_enhanced_image_only:
for item in task.results:
if temp_path not in item:
final_enhanced.append(item)
task.results = final_enhanced

if task.last_stop in ['stop', 'skip']:
task_status = task.last_stop
try:
Expand Down
12 changes: 8 additions & 4 deletions apis/utils/pre_process.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,12 @@

import numpy as np

from modules.config import default_max_lora_number, try_get_preset_content
from modules.flags import Performance, controlnet_image_count
from modules.config import (
default_max_lora_number,
try_get_preset_content,
default_controlnet_image_count
)
from modules.flags import Performance
from modules import constants, config
from modules.model_loader import load_file_from_url

Expand Down Expand Up @@ -78,10 +82,10 @@ async def control_net_parser(control_net: list) -> list:
"cn_weight": 0.6,
"cn_type": "ImagePrompt"
}
while len(control_net) < controlnet_image_count:
while len(control_net) < default_controlnet_image_count:
control_net.append(ImagePrompt(**default_cn_image))

control_net = control_net[:controlnet_image_count]
control_net = control_net[:default_controlnet_image_count]
cn_list = []
for cn in control_net:
cn_list.extend([
Expand Down
5 changes: 4 additions & 1 deletion args_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

args_parser.parser.add_argument("--theme", type=str, help="launches the UI with light or dark theme", default=None)
args_parser.parser.add_argument("--disable-image-log", action='store_true',
help="Prevent writing images and logs to hard drive.")
help="Prevent writing images and logs to the outputs folder.")

args_parser.parser.add_argument("--disable-analytics", action='store_true',
help="Disables analytics for Gradio.")
Expand All @@ -28,6 +28,9 @@
args_parser.parser.add_argument("--disable-preset-download", action='store_true',
help="Disables downloading models for presets", default=False)

args_parser.parser.add_argument("--disable-enhance-output-sorting", action='store_true',
help="Disables enhance output sorting for final image gallery.")

args_parser.parser.add_argument("--enable-auto-describe-image", action='store_true',
help="Enables automatic description of uov and enhance image when prompt is empty", default=False)

Expand Down
2 changes: 1 addition & 1 deletion fooocus_version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
version = '2.5.0'
version = '2.5.2'
3 changes: 3 additions & 0 deletions language/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@
"Read wildcards in order": "Read wildcards in order",
"Black Out NSFW": "Black Out NSFW",
"Use black image if NSFW is detected.": "Use black image if NSFW is detected.",
"Save only final enhanced image": "Save only final enhanced image",
"Save Metadata to Images": "Save Metadata to Images",
"Adds parameters to generated images allowing manual regeneration.": "Adds parameters to generated images allowing manual regeneration.",
"\ud83d\udcda History Log": "\uD83D\uDCDA History Log",
"Image Style": "Image Style",
"Fooocus V2": "Fooocus V2",
Expand Down
Loading

0 comments on commit 14b2eca

Please sign in to comment.