ifmain commited on
Commit
673e117
·
verified ·
1 Parent(s): 846a3c6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -4
app.py CHANGED
@@ -4,7 +4,7 @@ from moderation import *
4
 
5
 
6
  moderation = ModerationModel()
7
- moderation.load_state_dict(torch.load('moderation_model.pth', map_location=torch.device('cpu'))) #Remove map_location if run on gpu
8
  moderation.eval()
9
 
10
  def predict_moderation(text):
@@ -17,10 +17,9 @@ def predict_moderation(text):
17
 
18
  iface = gr.Interface(fn=predict_moderation,
19
  inputs="text",
20
- outputs=[gr.outputs.Label(label="Category Scores", type="confidences"),
21
- gr.outputs.Label(label="Detected")],
22
  title="Moderation Model",
23
  description="Enter text to check for moderation flags.")
24
 
25
 
26
- iface.launch()
 
4
 
5
 
6
  moderation = ModerationModel()
7
+ moderation.load_state_dict(torch.load('moderation_model.pth', map_location=torch.device('cpu'))) # Remove map_location if run on gpu
8
  moderation.eval()
9
 
10
  def predict_moderation(text):
 
17
 
18
  iface = gr.Interface(fn=predict_moderation,
19
  inputs="text",
20
+ outputs=[gr.Label(label="Category Scores"), gr.Label(label="Detected")],
 
21
  title="Moderation Model",
22
  description="Enter text to check for moderation flags.")
23
 
24
 
25
+ iface.launch()