Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -5,13 +5,7 @@ import torch, json
|
|
| 5 |
|
| 6 |
token = AutoTokenizer.from_pretrained('distilroberta-base')
|
| 7 |
|
| 8 |
-
types = ['
|
| 9 |
-
'severe_toxic',
|
| 10 |
-
'obscene',
|
| 11 |
-
'threat',
|
| 12 |
-
'insult',
|
| 13 |
-
'identity_hate',
|
| 14 |
-
'positive']
|
| 15 |
|
| 16 |
inf_session = onnxruntime.InferenceSession('classifier-quantized.onnx')
|
| 17 |
input_name = inf_session.get_inputs()[0].name
|
|
@@ -25,6 +19,6 @@ def classify(review):
|
|
| 25 |
return dict(zip(genres, map(float, probs)))
|
| 26 |
|
| 27 |
|
| 28 |
-
label = gr.outputs.Label(num_top_classes=
|
| 29 |
-
iface = gr.Interface(fn=
|
| 30 |
iface.launch(inline=False)
|
|
|
|
| 5 |
|
| 6 |
token = AutoTokenizer.from_pretrained('distilroberta-base')
|
| 7 |
|
| 8 |
+
types = ['Toxic','Severe_toxic','Obscene','Threat','Insult','Identity_hate','Positive']
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
|
| 10 |
inf_session = onnxruntime.InferenceSession('classifier-quantized.onnx')
|
| 11 |
input_name = inf_session.get_inputs()[0].name
|
|
|
|
| 19 |
return dict(zip(genres, map(float, probs)))
|
| 20 |
|
| 21 |
|
| 22 |
+
label = gr.outputs.Label(num_top_classes=5)
|
| 23 |
+
iface = gr.Interface(fn=classify_movie_genre, inputs="text", outputs=label)
|
| 24 |
iface.launch(inline=False)
|