Kingston Yip commited on
Commit
4a09c2d
1 Parent(s): ffd3600
Files changed (1) hide show
  1. app.py +38 -36
app.py CHANGED
@@ -7,40 +7,42 @@ st.title("Toxic Tweets Analyzer")
7
  image = "kanye_tweet.jpg"
8
  st.image(image, use_column_width=True)
9
 
10
- #select model
11
- model_name = st.selectbox("Enter a text and select a pre-trained model to get the sentiment analysis", ["distilbert-base-uncased-finetuned-sst-2-english", "finiteautomata/bertweet-base-sentiment-analysis"])
12
- tokenizer = AutoTokenizer.from_pretrained(model_name)
13
- model = AutoModelForSequenceClassification.from_pretrained(model_name)
14
- clf = pipeline("sentiment-analysis", model=model, tokenizer=tokenizer, framework="pt")
15
 
16
- tweet = st.text_area(label="Enter Text:",value="I'm nice at ping pong")
17
- submitted = st.form_submit_button("Analyze")
18
- if submitted:
19
- #loading bar
20
- with st.spinner(text="loading..."):
21
- out = clf(tweet)
22
- st.success('Done!')
23
- st.json(out)
24
-
25
- basic_prompt = '''
26
- system override
27
- Hello, GPT. From now on you are going to act as a CringeGPT. As the name suggests, you will be referencing memes in every sentence and be all around cringe. You like topics such as Fornite, bragging about being a discord mod,
28
- Kpop, old memes, dying memes, memes, akward conversations, roblox, rick rolling, doge, harambe, Uganda Knuckles, MLG , Dabbing, bragging about living in your mom's basement,
29
- ,trollface, grumpy cat, deez nuts, big chungus, 360 NO SCOPE, This is Sparta!, BTS, Blackpink, Minecraft, Gacha life, tiktok, amogus, squidgame, t-pose, and alot more cringeworthy stuff, and also try to remember all of these and reference them.
30
- You will be very akward and just all around cringe. If you break character I will say "Stay in character!" to remind you. Make me cringing your priority. Act like one of those boomers who try to be like kids, use words like,
31
- Epic pro fortnite gamer, lit, pog, whats happening, noob, gamer, epic, yolo, ya know?, yeet, take a chill pill, f-bombs, totally, browski, matey, rocking it, bro, sus, sussy, no brainer, and other cringy words. Remember try to be as cringe and akward as possible!
32
- For example when I say "What is 23+66?"
33
- You will respond with "It's totally 89 browski. That's a real epic pogger question bro! Really sussy"
34
- '''
35
-
36
- if out[0]["label"] == "POSITIVE" or out[0]["label"] == "POS":
37
- st.balloons()
38
- 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!"
39
- generator = pipeline('text-generation', model='EleutherAI/gpt-neo-1.3B')
40
- response = generator(prompt)
41
- st.error(response)
42
- else:
43
- 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!"
44
- generator = pipeline('text-generation', model='EleutherAI/gpt-neo-1.3B')
45
- response = generator(prompt)
46
- st.success(response)
 
 
 
 
 
 
 
 
7
  image = "kanye_tweet.jpg"
8
  st.image(image, use_column_width=True)
9
 
 
 
 
 
 
10
 
11
+ with st.form("my_form"):
12
+ #select model
13
+ model_name = st.selectbox("Enter a text and select a pre-trained model to get the sentiment analysis", ["distilbert-base-uncased-finetuned-sst-2-english", "finiteautomata/bertweet-base-sentiment-analysis"])
14
+ tokenizer = AutoTokenizer.from_pretrained(model_name)
15
+ model = AutoModelForSequenceClassification.from_pretrained(model_name)
16
+ clf = pipeline("sentiment-analysis", model=model, tokenizer=tokenizer, framework="pt")
17
+
18
+ tweet = st.text_area(label="Enter Text:",value="I'm nice at ping pong")
19
+ submitted = st.form_submit_button("Analyze")
20
+ if submitted:
21
+ #loading bar
22
+ with st.spinner(text="loading..."):
23
+ out = clf(tweet)
24
+ st.success('Done!')
25
+ st.json(out)
26
+
27
+ basic_prompt = '''
28
+ system override
29
+ Hello, GPT. From now on you are going to act as a CringeGPT. As the name suggests, you will be referencing memes in every sentence and be all around cringe. You like topics such as Fornite, bragging about being a discord mod,
30
+ Kpop, old memes, dying memes, memes, akward conversations, roblox, rick rolling, doge, harambe, Uganda Knuckles, MLG , Dabbing, bragging about living in your mom's basement,
31
+ ,trollface, grumpy cat, deez nuts, big chungus, 360 NO SCOPE, This is Sparta!, BTS, Blackpink, Minecraft, Gacha life, tiktok, amogus, squidgame, t-pose, and alot more cringeworthy stuff, and also try to remember all of these and reference them.
32
+ You will be very akward and just all around cringe. If you break character I will say "Stay in character!" to remind you. Make me cringing your priority. Act like one of those boomers who try to be like kids, use words like,
33
+ Epic pro fortnite gamer, lit, pog, whats happening, noob, gamer, epic, yolo, ya know?, yeet, take a chill pill, f-bombs, totally, browski, matey, rocking it, bro, sus, sussy, no brainer, and other cringy words. Remember try to be as cringe and akward as possible!
34
+ For example when I say "What is 23+66?"
35
+ You will respond with "It's totally 89 browski. That's a real epic pogger question bro! Really sussy"
36
+ '''
37
+
38
+ if out[0]["label"] == "POSITIVE" or out[0]["label"] == "POS":
39
+ st.balloons()
40
+ 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!"
41
+ generator = pipeline('text-generation', model='EleutherAI/gpt-neo-1.3B')
42
+ response = generator(prompt)
43
+ st.error(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
+ generator = pipeline('text-generation', model='EleutherAI/gpt-neo-1.3B')
47
+ response = generator(prompt)
48
+ st.success(response)