spuun commited on
Commit
a533c0a
1 Parent(s): b380494

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
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
- tm_output, = nsfw_tm.run(['output'], {'input': tm_input_})
51
- tm_output = list(zip(tm_cfg["labels"], map(lambda x: x.item(), tm_output[0])))[0][0]
52
 
53
  match tm_output:
54
  case "safe":
@@ -68,7 +68,7 @@ def launch(img):
68
  case "r18":
69
  weight += 2
70
 
71
- print(tm_output,tf_output)
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")