Spaces:
Runtime error
Runtime error
reduce score nsfw
Browse files- app/api/route.ts +1 -2
app/api/route.ts
CHANGED
@@ -50,10 +50,9 @@ export async function POST(
|
|
50 |
|
51 |
const isNSFW: any = await checkIfIsNSFW(blob)
|
52 |
if (isNSFW?.error) return Response.json({ status: 500, ok: false, message: isNSFW?.error });
|
53 |
-
|
54 |
if (isNSFW?.length) {
|
55 |
const scoreNotSafe = isNSFW?.find((n: { label: string }) => n.label === "no_safe");
|
56 |
-
if (scoreNotSafe?.score > 0.
|
57 |
return Response.json({ status: 401, ok: false, message: "Image is not safe for work." });
|
58 |
}
|
59 |
}
|
|
|
50 |
|
51 |
const isNSFW: any = await checkIfIsNSFW(blob)
|
52 |
if (isNSFW?.error) return Response.json({ status: 500, ok: false, message: isNSFW?.error });
|
|
|
53 |
if (isNSFW?.length) {
|
54 |
const scoreNotSafe = isNSFW?.find((n: { label: string }) => n.label === "no_safe");
|
55 |
+
if (scoreNotSafe?.score > 0.85) {
|
56 |
return Response.json({ status: 401, ok: false, message: "Image is not safe for work." });
|
57 |
}
|
58 |
}
|