Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -11,13 +11,15 @@ def classify(text):
|
|
11 |
|
12 |
def predict_sentiment(text, model):
|
13 |
if model == "finiteautomata/bertweet-base-sentiment-analysis":
|
14 |
-
pipe = pipeline("text-classification", model="finiteautomata/bertweet-base-sentiment-analysis")
|
15 |
-
out = pipe(text, return_all_scores=True)
|
16 |
-
return {pred["label"]: pred["score"] for pred in out[0]}
|
|
|
17 |
elif model == "vader":
|
18 |
-
nltk.download('vader_lexicon')
|
19 |
-
sia = SentimentIntensityAnalyzer()
|
20 |
-
return sia.polarity_scores(text)
|
|
|
21 |
|
22 |
|
23 |
|
|
|
11 |
|
12 |
def predict_sentiment(text, model):
|
13 |
if model == "finiteautomata/bertweet-base-sentiment-analysis":
|
14 |
+
# pipe = pipeline("text-classification", model="finiteautomata/bertweet-base-sentiment-analysis")
|
15 |
+
# out = pipe(text, return_all_scores=True)
|
16 |
+
# return {pred["label"]: pred["score"] for pred in out[0]}
|
17 |
+
return {"cathf": 0.3, "doghf": 0.7}
|
18 |
elif model == "vader":
|
19 |
+
# nltk.download('vader_lexicon')
|
20 |
+
# sia = SentimentIntensityAnalyzer()
|
21 |
+
# return sia.polarity_scores(text)
|
22 |
+
return {"catv": 0.3, "dogv": 0.7}
|
23 |
|
24 |
|
25 |
|