Yelp/yelp_review_full
Viewer • Updated • 700k • 22.9k • 145
How to use Neleac/yelp-review-classifier with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-classification", model="Neleac/yelp-review-classifier") # Load model directly
from transformers import AutoTokenizer, AutoModelForSequenceClassification
tokenizer = AutoTokenizer.from_pretrained("Neleac/yelp-review-classifier")
model = AutoModelForSequenceClassification.from_pretrained("Neleac/yelp-review-classifier")This model takes the text from a Yelp review and predicts a label corresponding to the number of stars for the review. The labels are:
from transformers import AutoTokenizer, pipeline
# Load the base model tokenizer
tokenizer = AutoTokenizer.from_pretrained('tabularisai/multilingual-sentiment-analysis')
# Load the classification pipeline with the specified model
pipe = pipeline("text-classification", model="Neleac/yelp-review-classifier", tokenizer=tokenizer)
# Classify a new Yelp review
review = "This is by far my favorite Panera location in the Pittsburgh area. \
Friendly, plenty of room to sit, and good quality food & coffee. \
Panera is a great place to hang out and read the news - they even have free WiFi! \
Try their toasted sandwiches, especially the chicken bacon dijon."
result = pipe(review)
# Print the result
print(result) # [{'label': 'Very Positive', 'score': 0.7158929109573364}]