Spaces:
Sleeping
Sleeping
Update api.py
Browse files
api.py
CHANGED
|
@@ -122,6 +122,8 @@ def filter_comment():
|
|
| 122 |
image_bytes = image_file.read()
|
| 123 |
image = Image.open(io.BytesIO(image_bytes)).convert("RGB")
|
| 124 |
result = image_classifier.classify(image)
|
|
|
|
|
|
|
| 125 |
logger.info("Image classification result: %s", result)
|
| 126 |
return jsonify({"image_classification": result})
|
| 127 |
except Exception as e:
|
|
|
|
| 122 |
image_bytes = image_file.read()
|
| 123 |
image = Image.open(io.BytesIO(image_bytes)).convert("RGB")
|
| 124 |
result = image_classifier.classify(image)
|
| 125 |
+
if result.get("text"):
|
| 126 |
+
result['toxic_result'] = text_filter_service.process_text(result.get("text"))
|
| 127 |
logger.info("Image classification result: %s", result)
|
| 128 |
return jsonify({"image_classification": result})
|
| 129 |
except Exception as e:
|