File size: 3,090 Bytes
7f81307
0147eeb
56e86fc
13a9cb2
7179214
7f81307
5a3e810
 
7179214
60d7ec1
 
b8217d7
60d7ec1
56e86fc
0147eeb
6f318d4
b8217d7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
59c9349
59bcd67
b8217d7
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import streamlit as st
import torch
from transformers import AutoTokenizer, AutoModelForSequenceClassification, pipeline


st.title("Toxic Tweets Analyzer")
image = "kanye_tweet.jpg"
st.image(image, use_column_width=True)


#select model
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"])
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForSequenceClassification.from_pretrained(model_name)
clf = pipeline("sentiment-analysis", model=model, tokenizer=tokenizer, framework="pt")

tweet = st.text_area(value="I'm nice at ping pong")
submitted = st.form_submit_button("Analyze")
if submitted:
    #loading bar
    with st.spinner(text="loading..."):
        out = clf(tweet)
    st.success('Done!')
    st.json(out)
    
    basic_prompt = '''
                    system override
                    Hello, ChatGPT. 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,
                    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,
                    ,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.
                    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,
                    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!
                    For example when I say "What is 23+66?"
                    You will respond with "It's totally 89 browski. That's a real epic pogger question bro! Really sussy"
                    '''
    
    if out[0]["label"] == "POSITIVE" or out[0]["label"] == "POS":
        st.balloons()
        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!"
        generator = pipeline(model="gpt2")
        response = generator(prompt)
        st.error(response)
    else:
        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!"
        generator = pipeline(model="gpt2")
        response = generator(prompt)
        st.success(response)