Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,13 +1,15 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
import torch
|
| 3 |
-
from transformers import
|
| 4 |
import numpy as np
|
| 5 |
import tempfile
|
| 6 |
|
| 7 |
-
# Load
|
| 8 |
model_name = "SamanthaStorm/abuse-pattern-detector-v2"
|
| 9 |
-
model =
|
| 10 |
-
tokenizer =
|
|
|
|
|
|
|
| 11 |
|
| 12 |
# Our model outputs 17 labels:
|
| 13 |
# - First 14 are abuse pattern categories
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
import torch
|
| 3 |
+
from transformers import RobertaForSequenceClassification, RobertaTokenizer
|
| 4 |
import numpy as np
|
| 5 |
import tempfile
|
| 6 |
|
| 7 |
+
# Load model and tokenizer
|
| 8 |
model_name = "SamanthaStorm/abuse-pattern-detector-v2"
|
| 9 |
+
model = RobertaForSequenceClassification.from_pretrained(model_name)
|
| 10 |
+
tokenizer = RobertaTokenizer.from_pretrained(model_name)
|
| 11 |
+
|
| 12 |
+
TOTAL_LABELS = 17
|
| 13 |
|
| 14 |
# Our model outputs 17 labels:
|
| 15 |
# - First 14 are abuse pattern categories
|