Spaces:
Runtime error
Runtime error
Commit
·
51a09b7
1
Parent(s):
63653f6
Update app.py
Browse files
app.py
CHANGED
|
@@ -25,6 +25,7 @@ model_name = ""
|
|
| 25 |
model_mapping = {
|
| 26 |
"Toxicity - 1 Epoch": "RobCaamano/toxicity",
|
| 27 |
"Toxicity - 8 Epochs": "RobCaamano/toxicity_update",
|
|
|
|
| 28 |
"DistilBERT Base Uncased (SST-2)": "distilbert-base-uncased-finetuned-sst-2-english",
|
| 29 |
}
|
| 30 |
|
|
@@ -47,7 +48,7 @@ input = tokenizer(text, return_tensors="tf")
|
|
| 47 |
if submit:
|
| 48 |
results = dict(d.values() for d in clf(text)[0])
|
| 49 |
|
| 50 |
-
if model_name in ["RobCaamano/toxicity", "RobCaamano/toxicity_update"]:
|
| 51 |
classes = {k: results[k] for k in results.keys() if not k == "toxic"}
|
| 52 |
|
| 53 |
max_class = max(classes, key=classes.get)
|
|
@@ -77,4 +78,4 @@ if submit:
|
|
| 77 |
st.table(result_df)
|
| 78 |
|
| 79 |
expander = st.expander("View Raw output")
|
| 80 |
-
expander.write(results)
|
|
|
|
| 25 |
model_mapping = {
|
| 26 |
"Toxicity - 1 Epoch": "RobCaamano/toxicity",
|
| 27 |
"Toxicity - 8 Epochs": "RobCaamano/toxicity_update",
|
| 28 |
+
"Toxicity - Weighted": "RobCaamano/toxicity_weighted",
|
| 29 |
"DistilBERT Base Uncased (SST-2)": "distilbert-base-uncased-finetuned-sst-2-english",
|
| 30 |
}
|
| 31 |
|
|
|
|
| 48 |
if submit:
|
| 49 |
results = dict(d.values() for d in clf(text)[0])
|
| 50 |
|
| 51 |
+
if model_name in ["RobCaamano/toxicity", "RobCaamano/toxicity_update", "RobCaamano/toxicity_weighted"]:
|
| 52 |
classes = {k: results[k] for k in results.keys() if not k == "toxic"}
|
| 53 |
|
| 54 |
max_class = max(classes, key=classes.get)
|
|
|
|
| 78 |
st.table(result_df)
|
| 79 |
|
| 80 |
expander = st.expander("View Raw output")
|
| 81 |
+
expander.write(results)
|