Instructions to use sanjin7/ctr-ll4 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use sanjin7/ctr-ll4 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="sanjin7/ctr-ll4", trust_remote_code=True)# Load model directly from transformers import AutoModelForSequenceClassification model = AutoModelForSequenceClassification.from_pretrained("sanjin7/ctr-ll4", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
| from langdetect import detect | |
| from loguru import logger | |
| from nltk.sentiment import SentimentIntensityAnalyzer | |
| from textblob import TextBlob | |
| def detect_language(text: str) -> None | str: | |
| try: | |
| return detect(text) | |
| except Exception: | |
| logger.debug(f"No language features: {text}") | |
| return None | |
| sia = SentimentIntensityAnalyzer() | |
| def get_sentiment(text: str) -> dict: | |
| sentiment = sia.polarity_scores(text) | |
| sentiment["subjectivity"] = TextBlob(text).subjectivity | |
| return sentiment | |