Spaces:
Running
Running
Update app.py
Browse files
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.
|
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()
|