Instructions to use Jabbari/AsA with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Jabbari/AsA with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="Jabbari/AsA")# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("Jabbari/AsA", device_map="auto") - Notebooks
- Google Colab
- Kaggle
File size: 757 Bytes
332a2d7 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | from transformers import AutoModelForSequenceClassification,AutoTokenizer
#import tensorflow as tf
#print(tf.__version__)
# replace "path/to/model/directory" with the path to the directory containing the model files
tokenizer = AutoTokenizer.from_pretrained("ALANZI/imamu_arabic_sentimentAnalysis")
model = AutoModelForSequenceClassification.from_pretrained("ALANZI/imamu_arabic_sentimentAnalysis")
def predict_sentiment(text):
# Tokenize input text
inputs = tokenizer(text, return_tensors="pt")
# Pass the tokenized inputs through the model
outputs = model(**inputs)
# Get predicted sentiment
predictions = outputs.logits.argmax(dim=1)
sentiment = "Negative" if predictions.item() == 1 else "Positive"
return sentiment
|