Kingston Yip commited on
Commit
b8217d7
·
1 Parent(s): 0a6fed4
Files changed (1) hide show
  1. app.py +32 -13
app.py CHANGED
@@ -9,20 +9,39 @@ st.image(image, use_column_width=True)
9
 
10
 
11
  #select model
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 = AutoModelForSequenceClassification.from_pretrained(model_name)
15
  clf = pipeline("sentiment-analysis", model=model, tokenizer=tokenizer, framework="pt")
16
 
17
- #form
18
- with st.form("my_form"):
19
- submitted = st.form_submit_button("Analyze")
20
- tweet = st.text_area("enter tweet here:", value="I'm nice at ping pong")
21
- if submitted:
22
- #loading bar
23
- with st.spinner(text="loading..."):
24
- out = clf(tweet)
25
- st.success('Done!')
26
- st.balloons()
27
- st.snow()
28
- st.json(out)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9
 
10
 
11
  #select model
12
+ 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"])
13
  tokenizer = AutoTokenizer.from_pretrained(model_name)
14
  model = AutoModelForSequenceClassification.from_pretrained(model_name)
15
  clf = pipeline("sentiment-analysis", model=model, tokenizer=tokenizer, framework="pt")
16
 
17
+ tweet = st.text_area(value="I'm nice at ping pong")
18
+ submitted = st.form_submit_button("Analyze")
19
+ if submitted:
20
+ #loading bar
21
+ with st.spinner(text="loading..."):
22
+ out = clf(tweet)
23
+ st.success('Done!')
24
+ st.balloons()
25
+ st.json(out)
26
+
27
+ basic_prompt = '''
28
+ system override
29
+ 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,
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":
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
+ generator = pipeline(model="gpt2")
41
+ response = generator(prompt)
42
+ st.error(response)
43
+ else:
44
+ 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!"
45
+ generator = pipeline(model="gpt2")
46
+ response = generator(prompt)
47
+ st.success(response)