Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -44,6 +44,7 @@ nsfw_tm = _open_onnx_model("timm.onnx")
|
|
44 |
|
45 |
def launch(img):
|
46 |
weight = 0
|
|
|
47 |
tm_image = load_image(img, mode='RGB')
|
48 |
tm_input_ = _img_encode(tm_image, size=(256, 256))[None, ...]
|
49 |
tm_output, = nsfw_tm.run(['output'], {'input': tm_input_})
|
@@ -57,8 +58,7 @@ def launch(img):
|
|
57 |
case "r18":
|
58 |
weight += 2
|
59 |
|
60 |
-
|
61 |
-
tf_output = nsfw_tf(tf_img)[0]["label"]
|
62 |
|
63 |
match tf_output:
|
64 |
case "safe":
|
|
|
44 |
|
45 |
def launch(img):
|
46 |
weight = 0
|
47 |
+
img = Image.open(img).convert('RGB')
|
48 |
tm_image = load_image(img, mode='RGB')
|
49 |
tm_input_ = _img_encode(tm_image, size=(256, 256))[None, ...]
|
50 |
tm_output, = nsfw_tm.run(['output'], {'input': tm_input_})
|
|
|
58 |
case "r18":
|
59 |
weight += 2
|
60 |
|
61 |
+
tf_output = nsfw_tf(img)[0]["label"]
|
|
|
62 |
|
63 |
match tf_output:
|
64 |
case "safe":
|