Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -23,31 +23,24 @@ st.sidebar.markdown(
|
|
23 |
|
24 |
# uncomment the options below to test out the app with a variety of classification models.
|
25 |
models = {
|
26 |
-
|
27 |
-
|
28 |
-
# "textattack/roberta-base-rotten-tomatoes": "",
|
29 |
-
# "mrm8488/bert-mini-finetuned-age_news-classification": "BERT-Mini finetuned on AG News dataset. Predicts news class (sports/tech/business/world) of text.",
|
30 |
-
# "nateraw/bert-base-uncased-ag-news": "BERT finetuned on AG News dataset. Predicts news class (sports/tech/business/world) of text.",
|
31 |
"distilbert-base-uncased-finetuned-sst-2-english": "DistilBERT model finetuned on SST-2 sentiment analysis task. Predicts positive/negative sentiment.",
|
32 |
-
|
33 |
"sampathkethineedi/industry-classification": "DistilBERT Model to classify a business description into one of 62 industry tags.",
|
34 |
"MoritzLaurer/policy-distilbert-7d": "DistilBERT model finetuned to classify text into one of seven political categories.",
|
35 |
# # "MoritzLaurer/covid-policy-roberta-21": "(Under active development ) RoBERTA model finetuned to identify COVID policy measure classes ",
|
36 |
-
|
37 |
}
|
38 |
model_name = st.sidebar.selectbox(
|
39 |
"Choose a classification model", list(models.keys())
|
40 |
)
|
41 |
model, tokenizer = load_model(model_name)
|
42 |
|
43 |
-
|
44 |
-
print ("Model loaded")
|
45 |
-
if model_name.startswith("textattack/"):
|
46 |
-
model.config.id2label = {0: "NEGATIVE (0) ", 1: "POSITIVE (1)"}
|
47 |
model.eval()
|
48 |
-
|
49 |
cls_explainer = SequenceClassificationExplainer(model=model, tokenizer=tokenizer)
|
50 |
-
|
51 |
if cls_explainer.accepts_position_ids:
|
52 |
emb_type_name = st.sidebar.selectbox(
|
53 |
"Choose embedding type for attribution.", ["word", "position"]
|
|
|
23 |
|
24 |
# uncomment the options below to test out the app with a variety of classification models.
|
25 |
models = {
|
26 |
+
"mrm8488/bert-mini-finetuned-age_news-classification": "BERT-Mini finetuned on AG News dataset. Predicts news class (sports/tech/business/world) of text.",
|
27 |
+
"nateraw/bert-base-uncased-ag-news": "BERT finetuned on AG News dataset. Predicts news class (sports/tech/business/world) of text.",
|
|
|
|
|
|
|
28 |
"distilbert-base-uncased-finetuned-sst-2-english": "DistilBERT model finetuned on SST-2 sentiment analysis task. Predicts positive/negative sentiment.",
|
29 |
+
"ProsusAI/finbert": "BERT model finetuned to predict sentiment of financial text. Finetuned on Financial PhraseBank data. Predicts positive/negative/neutral.",
|
30 |
"sampathkethineedi/industry-classification": "DistilBERT Model to classify a business description into one of 62 industry tags.",
|
31 |
"MoritzLaurer/policy-distilbert-7d": "DistilBERT model finetuned to classify text into one of seven political categories.",
|
32 |
# # "MoritzLaurer/covid-policy-roberta-21": "(Under active development ) RoBERTA model finetuned to identify COVID policy measure classes ",
|
33 |
+
"mrm8488/bert-tiny-finetuned-sms-spam-detection": "Tiny bert model finetuned for spam detection. 0 == not spam, 1 == spam",
|
34 |
}
|
35 |
model_name = st.sidebar.selectbox(
|
36 |
"Choose a classification model", list(models.keys())
|
37 |
)
|
38 |
model, tokenizer = load_model(model_name)
|
39 |
|
|
|
|
|
|
|
|
|
40 |
model.eval()
|
41 |
+
|
42 |
cls_explainer = SequenceClassificationExplainer(model=model, tokenizer=tokenizer)
|
43 |
+
|
44 |
if cls_explainer.accepts_position_ids:
|
45 |
emb_type_name = st.sidebar.selectbox(
|
46 |
"Choose embedding type for attribution.", ["word", "position"]
|