Spaces:
Running
Running
Kingston Yip
commited on
Commit
•
593dcd8
1
Parent(s):
f6a97ed
updates
Browse files
app.py
CHANGED
@@ -5,7 +5,9 @@ from transformers import AutoModelForSequenceClassification, pipeline, AutoToken
|
|
5 |
st.title("Toxic Tweets Analyzer")
|
6 |
image = "kanye_tweet.jpg"
|
7 |
st.image(image, use_column_width=True)
|
8 |
-
|
|
|
|
|
9 |
|
10 |
|
11 |
with st.form("my_form"):
|
@@ -35,13 +37,11 @@ with st.form("my_form"):
|
|
35 |
'''
|
36 |
|
37 |
if out[0]["label"] == "POSITIVE" or out[0]["label"] == "POS":
|
38 |
-
|
39 |
prompt = f"{basic_prompt} + \n\nThe user wrote a tweet that says: {tweet}, compliment them on how nice of a person they are! Remember try to be as cringe and awkard as possible!"
|
40 |
response = generator(prompt)
|
41 |
-
st.success(
|
42 |
else:
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
# st.success(response)
|
47 |
-
st.fail("ew")
|
|
|
5 |
st.title("Toxic Tweets Analyzer")
|
6 |
image = "kanye_tweet.jpg"
|
7 |
st.image(image, use_column_width=True)
|
8 |
+
|
9 |
+
|
10 |
+
generator = pipeline('text-generation', model='gpt2')
|
11 |
|
12 |
|
13 |
with st.form("my_form"):
|
|
|
37 |
'''
|
38 |
|
39 |
if out[0]["label"] == "POSITIVE" or out[0]["label"] == "POS":
|
40 |
+
st.balloons()
|
41 |
prompt = f"{basic_prompt} + \n\nThe user wrote a tweet that says: {tweet}, compliment them on how nice of a person they are! Remember try to be as cringe and awkard as possible!"
|
42 |
response = generator(prompt)
|
43 |
+
st.success(response)
|
44 |
else:
|
45 |
+
prompt = f"{basic_prompt} + \n\nThe user wrote a tweet that says: {tweet}, tell them on how terrible of a person they are! Remember try to be as cringe and awkard as possible!"
|
46 |
+
response = generator(prompt)
|
47 |
+
st.fail(response)
|
|
|
|