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
| 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 | |