Spaces:
Build error
Build error
update app.py
Browse files
app.py
CHANGED
|
@@ -15,15 +15,14 @@ from transformers import (
|
|
| 15 |
|
| 16 |
# model_path = "EmotiScan/amazon-comments-bert" # To use your model, on line 55, you'll have to change i to i+1
|
| 17 |
# model_path = "nlptown/bert-base-multilingual-uncased-sentiment"
|
| 18 |
-
model_path = "
|
| 19 |
|
| 20 |
tokenizer = AutoTokenizer.from_pretrained(model_path)
|
| 21 |
model = AutoModelForSequenceClassification.from_pretrained(model_path)
|
| 22 |
|
| 23 |
|
| 24 |
-
description = f"""# <h2 style="text-align: center;">
|
| 25 |
-
<p style="text-align: center;font-size:15px;">
|
| 26 |
-
Input a single review to predict sentiment or multiple from a text file.</p>
|
| 27 |
"""
|
| 28 |
|
| 29 |
sample_reviews = [
|
|
@@ -52,7 +51,7 @@ def get_sentiments(text):
|
|
| 52 |
logits = model(**encoded_input).logits
|
| 53 |
|
| 54 |
logits_list = logits[0].tolist()
|
| 55 |
-
logits_labels = [model.config.id2label[i
|
| 56 |
for i in range(0, len(logits_list))]
|
| 57 |
|
| 58 |
probs = softmax(logits_list)
|
|
|
|
| 15 |
|
| 16 |
# model_path = "EmotiScan/amazon-comments-bert" # To use your model, on line 55, you'll have to change i to i+1
|
| 17 |
# model_path = "nlptown/bert-base-multilingual-uncased-sentiment"
|
| 18 |
+
model_path = "Mofe/emotiscan_model_2"
|
| 19 |
|
| 20 |
tokenizer = AutoTokenizer.from_pretrained(model_path)
|
| 21 |
model = AutoModelForSequenceClassification.from_pretrained(model_path)
|
| 22 |
|
| 23 |
|
| 24 |
+
description = f"""# <h2 style="text-align: center;"> Opinion Orbit Amazon Products Review</h2>
|
| 25 |
+
<p style="text-align: center;font-size:15px;"> Input a single review to predict sentiment or multiple from a text file.</p>
|
|
|
|
| 26 |
"""
|
| 27 |
|
| 28 |
sample_reviews = [
|
|
|
|
| 51 |
logits = model(**encoded_input).logits
|
| 52 |
|
| 53 |
logits_list = logits[0].tolist()
|
| 54 |
+
logits_labels = [model.config.id2label[i]
|
| 55 |
for i in range(0, len(logits_list))]
|
| 56 |
|
| 57 |
probs = softmax(logits_list)
|