Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: mark all non-censored nsfw images in info #300

Merged
merged 2 commits into from
Sep 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion horde_worker_regen/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

ASSETS_FOLDER_PATH = Path(__file__).parent / "assets"

__version__ = "9.0.5"
__version__ = "9.0.6"


import pkg_resources # noqa: E402
Expand Down
2 changes: 1 addition & 1 deletion horde_worker_regen/_version_meta.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"recommended_version": "9.0.5",
"recommended_version": "9.0.6",
"required_min_version": "9.0.2",
"required_min_version_update_date": "2024-09-26",
"required_min_version_info": {
Expand Down
40 changes: 21 additions & 19 deletions horde_worker_regen/process_management/process_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -1804,32 +1804,34 @@ def receive_and_handle_process_messages(self) -> None:

if any_safety_failed:
completed_job_info.state = GENERATION_STATE.faulted
elif num_images_censored > 0:
completed_job_info.censored = True
for i in range(len(completed_job_info.job_image_results)):
if message.safety_evaluations[i].is_csam:
completed_job_info.censored = False
for i in range(len(completed_job_info.job_image_results)):
if message.safety_evaluations[i].is_csam:
new_meta_entry = GenMetadataEntry(
type=METADATA_TYPE.censorship,
value=METADATA_VALUE.csam,
)
completed_job_info.job_image_results[i].generation_faults.append(new_meta_entry)
completed_job_info.state = GENERATION_STATE.csam
completed_job_info.censored = True
elif message.safety_evaluations[i].is_nsfw:
# This just marks images as nsfw, if not censored already
if message.safety_evaluations[i].replacement_image_base64 is None:
new_meta_entry = GenMetadataEntry(
type=METADATA_TYPE.censorship,
value=METADATA_VALUE.csam,
type=METADATA_TYPE.information,
value=METADATA_VALUE.nsfw,
)
completed_job_info.job_image_results[i].generation_faults.append(new_meta_entry)
completed_job_info.state = GENERATION_STATE.csam
elif message.safety_evaluations[i].is_nsfw:
else:
new_meta_entry = GenMetadataEntry(
type=METADATA_TYPE.information,
type=METADATA_TYPE.censorship,
value=METADATA_VALUE.nsfw,
)
completed_job_info.job_image_results[i].generation_faults.append(new_meta_entry)
if message.safety_evaluations[i].replacement_image_base64 is not None:
new_meta_entry = GenMetadataEntry(
type=METADATA_TYPE.censorship,
value=METADATA_VALUE.nsfw,
)
completed_job_info.job_image_results[i].generation_faults.append(new_meta_entry)
if completed_job_info.state != GENERATION_STATE.csam:
completed_job_info.state = GENERATION_STATE.censored
else:
completed_job_info.censored = False
completed_job_info.censored = True
if completed_job_info.state != GENERATION_STATE.csam:
completed_job_info.state = GENERATION_STATE.censored

# logger.debug([c.generation_faults for c in completed_job_info.job_image_results])
self.completed_jobs.append(completed_job_info)

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "horde_worker_regen"
version = "9.0.5"
version = "9.0.6"
description = "Allows you to connect to the AI Horde and generate images for users."
authors = [
{name = "tazlin", email = "[email protected]"},
Expand Down
Loading