Skip to content

Commit

Permalink
Merge pull request replicate#69 from replicate/better-readability
Browse files Browse the repository at this point in the history
hard to read conditional
  • Loading branch information
zeke committed Jan 6, 2023
2 parents 05496d2 + 5fad8d9 commit 3851052
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions predict.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,12 @@ def predict(

output_paths = []
for i, sample in enumerate(output.images):
if output.nsfw_content_detected and not output.nsfw_content_detected[i]:
output_path = f"/tmp/out-{i}.png"
sample.save(output_path)
output_paths.append(Path(output_path))
if output.nsfw_content_detected and output.nsfw_content_detected[i]:
continue

output_path = f"/tmp/out-{i}.png"
sample.save(output_path)
output_paths.append(Path(output_path))

if len(output_paths) == 0:
raise Exception(
Expand Down

0 comments on commit 3851052

Please sign in to comment.