Kingston Yip commited on
Commit
869a57d
β€’
1 Parent(s): d1320a7
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -3,7 +3,7 @@ import torch
3
  from transformers import AutoModelForSequenceClassification, pipeline, AutoTokenizer, DistilBertForSequenceClassification, DistilBertTokenizerFast
4
  import pandas as pd
5
  import comments
6
- from random import randin
7
  import requests
8
 
9
 
@@ -80,7 +80,7 @@ with st.form("my_form"):
80
  default = "I'm nice at ping pong"
81
  tweet = st.text_area(label="Enter Text:",value=default)
82
  submitted = st.form_submit_button("Analyze textbox")
83
- random = st.form_submit_button("Analyze a random 😈😈😈 tweet (warning!!)")
84
  kanye = st.form_submit_button("Get a ye quote 🐻🎀🎧🎢")
85
 
86
  if random:
@@ -93,10 +93,10 @@ with st.form("my_form"):
93
  if response.status_code == 200:
94
  data = response.json()
95
  tweet = data['quote']
96
- print(f'Kanye says: "{tweet}"')
97
  else:
98
- print(f'Error {response.status_code}: Failed to retrieve Kanye quote')
99
  st.write(tweet)
 
100
 
101
  if submitted:
102
  df = perform_cyberbullying_analysis(tweet)
 
3
  from transformers import AutoModelForSequenceClassification, pipeline, AutoTokenizer, DistilBertForSequenceClassification, DistilBertTokenizerFast
4
  import pandas as pd
5
  import comments
6
+ from random import randint
7
  import requests
8
 
9
 
 
80
  default = "I'm nice at ping pong"
81
  tweet = st.text_area(label="Enter Text:",value=default)
82
  submitted = st.form_submit_button("Analyze textbox")
83
+ random = st.form_submit_button("Get a random 😈😈😈 tweet (warning!!)")
84
  kanye = st.form_submit_button("Get a ye quote 🐻🎀🎧🎢")
85
 
86
  if random:
 
93
  if response.status_code == 200:
94
  data = response.json()
95
  tweet = data['quote']
 
96
  else:
97
+ st.error("Error getting Kanye quote | status code: " + str(response.status_code))
98
  st.write(tweet)
99
+ submitted = True
100
 
101
  if submitted:
102
  df = perform_cyberbullying_analysis(tweet)