Ariel Hsieh commited on
Commit
0afd711
1 Parent(s): ceafef9

update app.py

Browse files
Files changed (1) hide show
  1. app.py +0 -55
app.py CHANGED
@@ -78,61 +78,6 @@ else:
78
  score = result[0]["score"]
79
  st.write("The classification of the given text is " + label + " with a score of " + str(score))
80
 
81
- # main_class = [(23.93,0),(78.987,0)]
82
- # toxic_type = []
83
-
84
- # if model == "roberta-large-mnli":
85
- # #1
86
- # if st.button("Run Sentiment Analysis of Text"):
87
- # model_path = "roberta-large-mnli"
88
- # sentiment_pipeline = pipeline(model=model_path)
89
- # result = sentiment_pipeline(data)
90
- # label = result[0]["label"]
91
- # score = result[0]["score"]
92
- # d = {'tweet':[model_path],'classification':[label],'score':[score]}
93
- # dataframe = pd.DataFrame(data=d)
94
- # st.table(dataframe)
95
- #st.write("The classification of the given text is " + label + " with a score of " + str(score))
96
-
97
-
98
- # data = []
99
- # text = st.text_input("Enter text here:","Artificial Intelligence is useful")
100
- # data.append(text)
101
- # if model == "roberta-large-mnli":
102
- # #1
103
- # if st.button("Run Sentiment Analysis of Text"):
104
- # model_path = "roberta-large-mnli"
105
- # sentiment_pipeline = pipeline(model=model_path)
106
- # result = sentiment_pipeline(data)
107
- # label = result[0]["label"]
108
- # score = result[0]["score"]
109
- # st.write("The classification of the given text is " + label + " with a score of " + str(score))
110
- # elif model == "twitter-XLM-roBERTa-base":
111
- # #2
112
- # if st.button("Run Sentiment Analysis of Text"):
113
- # model_path = "cardiffnlp/twitter-xlm-roberta-base-sentiment"
114
- # sentiment_task = pipeline("sentiment-analysis", model=model_path, tokenizer=model_path)
115
- # result = sentiment_task(text)
116
- # label = result[0]["label"].capitalize()
117
- # score = result[0]["score"]
118
- # st.write("The classification of the given text is " + label + " with a score of " + str(score))
119
-
120
- # elif model == "bertweet-sentiment-analysis":
121
- # #3
122
- # if st.button("Run Sentiment Analysis of Text"):
123
- # analyzer = create_analyzer(task="sentiment", lang="en")
124
- # result = analyzer.predict(text)
125
- # if result.output == "POS":
126
- # label = "POSITIVE"
127
- # elif result.output == "NEU":
128
- # label = "NEUTRAL"
129
- # else:
130
- # label = "NEGATIVE"
131
-
132
- # neg = result.probas["NEG"]
133
- # pos = result.probas["POS"]
134
- # neu = result.probas["NEU"]
135
- # st.write("The classification of the given text is " + label + " with the scores broken down as: Positive - " + str(pos) + ", Neutral - " + str(neu) + ", Negative - " + str(neg))
136
 
137
 
138
 
 
78
  score = result[0]["score"]
79
  st.write("The classification of the given text is " + label + " with a score of " + str(score))
80
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
81
 
82
 
83