Spaces:
Sleeping
Sleeping
Kingston Yip
commited on
Commit
·
56e86fc
1
Parent(s):
0147eeb
updates
Browse files
app.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
import streamlit as st
|
| 2 |
import torch
|
| 3 |
-
from transformers import AutoTokenizer,
|
| 4 |
|
| 5 |
|
| 6 |
st.title("Toxic Tweets Analyzer")
|
|
@@ -11,7 +11,7 @@ st.image(image, use_column_width=True)
|
|
| 11 |
#select model
|
| 12 |
model_name = st.selectbox("Select model", ["distilbert-base-uncased-finetuned-sst-2-english", "finiteautomata/bertweet-base-sentiment-analysis"])
|
| 13 |
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
| 14 |
-
model =
|
| 15 |
clf = pipeline("sentiment-analysis", model=model, tokenizer=tokenizer, framework="pt")
|
| 16 |
|
| 17 |
#form
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
import torch
|
| 3 |
+
from transformers import AutoTokenizer, AutoModelForSequenceClassification, pipeline
|
| 4 |
|
| 5 |
|
| 6 |
st.title("Toxic Tweets Analyzer")
|
|
|
|
| 11 |
#select model
|
| 12 |
model_name = st.selectbox("Select model", ["distilbert-base-uncased-finetuned-sst-2-english", "finiteautomata/bertweet-base-sentiment-analysis"])
|
| 13 |
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
| 14 |
+
model = AutoModelForSequenceClassification.from_pretrained(model_name)
|
| 15 |
clf = pipeline("sentiment-analysis", model=model, tokenizer=tokenizer, framework="pt")
|
| 16 |
|
| 17 |
#form
|