Spaces:
Sleeping
Sleeping
Kingston Yip
commited on
Commit
β’
743c8db
1
Parent(s):
611cacb
removed cache
Browse files
app.py
CHANGED
@@ -27,7 +27,7 @@ def predict_cyberbullying_probability(sentence, tokenizer, model):
|
|
27 |
|
28 |
# @st.cache
|
29 |
def perform_cyberbullying_analysis(tweet):
|
30 |
-
with st.spinner(text="loading model..."):
|
31 |
|
32 |
model = AutoModelForSequenceClassification.from_pretrained('kingsotn/finetuned_cyberbullying')
|
33 |
tokenizer = DistilBertTokenizerFast.from_pretrained('distilbert-base-uncased')
|
@@ -81,11 +81,10 @@ with st.form("my_form"):
|
|
81 |
model_name = st.selectbox("Enter a text and select a pre-trained model to get the sentiment analysis", ["kingsotn/finetuned_cyberbullying", "distilbert-base-uncased-finetuned-sst-2-english", "finiteautomata/bertweet-base-sentiment-analysis", "distilbert-base-uncased"])
|
82 |
|
83 |
if model_name == "kingsotn/finetuned_cyberbullying":
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
random = st.form_submit_button("Analyze a random πππ tweet")
|
89 |
|
90 |
if random:
|
91 |
tweet = comments.comments[randint(0, 354)]
|
|
|
27 |
|
28 |
# @st.cache
|
29 |
def perform_cyberbullying_analysis(tweet):
|
30 |
+
with st.spinner(text="loading model, wait until spinner ends..."):
|
31 |
|
32 |
model = AutoModelForSequenceClassification.from_pretrained('kingsotn/finetuned_cyberbullying')
|
33 |
tokenizer = DistilBertTokenizerFast.from_pretrained('distilbert-base-uncased')
|
|
|
81 |
model_name = st.selectbox("Enter a text and select a pre-trained model to get the sentiment analysis", ["kingsotn/finetuned_cyberbullying", "distilbert-base-uncased-finetuned-sst-2-english", "finiteautomata/bertweet-base-sentiment-analysis", "distilbert-base-uncased"])
|
82 |
|
83 |
if model_name == "kingsotn/finetuned_cyberbullying":
|
84 |
+
default = "I'm nice at ping pong"
|
85 |
+
tweet = st.text_area(label="Enter Text:",value=default)
|
86 |
+
submitted = st.form_submit_button("Analyze textbox")
|
87 |
+
random = st.form_submit_button("Analyze a random πππ tweet")
|
|
|
88 |
|
89 |
if random:
|
90 |
tweet = comments.comments[randint(0, 354)]
|