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