Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -47,8 +47,8 @@ def launch(img):
|
|
47 |
img = img.convert('RGB')
|
48 |
tm_image = load_image(img, mode='RGB')
|
49 |
tm_input_ = _img_encode(tm_image, size=(256, 256))[None, ...]
|
50 |
-
|
51 |
-
tm_output = list(zip(tm_cfg["labels"], map(lambda x: x.item(),
|
52 |
|
53 |
match tm_output:
|
54 |
case "safe":
|
@@ -68,7 +68,7 @@ def launch(img):
|
|
68 |
case "r18":
|
69 |
weight += 2
|
70 |
|
71 |
-
print(
|
72 |
return weight > 0
|
73 |
|
74 |
app = gr.Interface(fn=launch, inputs="pil", outputs="text")
|
|
|
47 |
img = img.convert('RGB')
|
48 |
tm_image = load_image(img, mode='RGB')
|
49 |
tm_input_ = _img_encode(tm_image, size=(256, 256))[None, ...]
|
50 |
+
tm_items, = nsfw_tm.run(['output'], {'input': tm_input_})
|
51 |
+
tm_output = list(zip(tm_cfg["labels"], map(lambda x: x.item(), tm_items[0])))[0][0]
|
52 |
|
53 |
match tm_output:
|
54 |
case "safe":
|
|
|
68 |
case "r18":
|
69 |
weight += 2
|
70 |
|
71 |
+
print(list(zip(tm_cfg["labels"], map(lambda x: x.item(), tm_items[0]))),tf_output)
|
72 |
return weight > 0
|
73 |
|
74 |
app = gr.Interface(fn=launch, inputs="pil", outputs="text")
|