Spaces:
Runtime error
Runtime error
Jeffrey Rathgeber Jr
commited on
testagain
Browse files
app.py
CHANGED
@@ -14,14 +14,16 @@ while True:
|
|
14 |
st.write('You selected:', option)
|
15 |
|
16 |
if option == 'MILESTONE 3: FINE-TUNED':
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
|
|
|
|
25 |
|
26 |
# model_name_0 = "Rathgeberj/milestone3_0"
|
27 |
# model_0 = AutoModelForSequenceClassification.from_pretrained(model_name_0)
|
@@ -73,17 +75,17 @@ while True:
|
|
73 |
preds = [{"score": round(pred["score"], 4), "label": pred["label"]} for pred in preds]
|
74 |
st.write('According to Pipeline, input text is ', preds[0]['label'], ' with a confidence of ', preds[0]['score'])
|
75 |
|
76 |
-
if option == 'TextBlob':
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
|
88 |
|
89 |
#------------------------------------------------------------------------
|
|
|
14 |
st.write('You selected:', option)
|
15 |
|
16 |
if option == 'MILESTONE 3: FINE-TUNED':
|
17 |
+
polarity = TextBlob(textIn).sentiment.polarity
|
18 |
+
subjectivity = TextBlob(textIn).sentiment.subjectivity
|
19 |
+
sentiment = ''
|
20 |
+
if polarity < 0:
|
21 |
+
sentiment = 'Negative'
|
22 |
+
elif polarity == 0:
|
23 |
+
sentiment = 'Neutral'
|
24 |
+
else:
|
25 |
+
sentiment = 'Positive'
|
26 |
+
st.write('According to TextBlob, input text is ', sentiment, ' and a subjectivity score (from 0 being objective to 1 being subjective) of ', subjectivity)
|
27 |
|
28 |
# model_name_0 = "Rathgeberj/milestone3_0"
|
29 |
# model_0 = AutoModelForSequenceClassification.from_pretrained(model_name_0)
|
|
|
75 |
preds = [{"score": round(pred["score"], 4), "label": pred["label"]} for pred in preds]
|
76 |
st.write('According to Pipeline, input text is ', preds[0]['label'], ' with a confidence of ', preds[0]['score'])
|
77 |
|
78 |
+
# if option == 'TextBlob':
|
79 |
+
# polarity = TextBlob(textIn).sentiment.polarity
|
80 |
+
# subjectivity = TextBlob(textIn).sentiment.subjectivity
|
81 |
+
# sentiment = ''
|
82 |
+
# if polarity < 0:
|
83 |
+
# sentiment = 'Negative'
|
84 |
+
# elif polarity == 0:
|
85 |
+
# sentiment = 'Neutral'
|
86 |
+
# else:
|
87 |
+
# sentiment = 'Positive'
|
88 |
+
# st.write('According to TextBlob, input text is ', sentiment, ' and a subjectivity score (from 0 being objective to 1 being subjective) of ', subjectivity)
|
89 |
|
90 |
|
91 |
#------------------------------------------------------------------------
|