Update app.py
Browse files
app.py
CHANGED
|
@@ -121,9 +121,10 @@ def generate(input=DEFAULT_INPUT, filter_input="", negative_input=DEFAULT_NEGATI
|
|
| 121 |
|
| 122 |
print(image_paths)
|
| 123 |
|
| 124 |
-
nsfw_prediction = repo_nsfw_classifier(**processor_nsfw_classifier(images=Image.open(image_paths[0]), return_tensors="pt")).logits
|
| 125 |
|
| 126 |
print(nsfw_prediction)
|
|
|
|
| 127 |
|
| 128 |
return image_paths, {item['label']: round(item['score'], 3) for item in nsfw_prediction}
|
| 129 |
|
|
|
|
| 121 |
|
| 122 |
print(image_paths)
|
| 123 |
|
| 124 |
+
nsfw_prediction = repo_nsfw_classifier(**processor_nsfw_classifier(images=Image.open(image_paths[0]), return_tensors="pt")).logits.argmax(-1).item()
|
| 125 |
|
| 126 |
print(nsfw_prediction)
|
| 127 |
+
print(repo_nsfw_classifier.config.id2label[nsfw_prediction])
|
| 128 |
|
| 129 |
return image_paths, {item['label']: round(item['score'], 3) for item in nsfw_prediction}
|
| 130 |
|