Instructions to use KrishnanDevilking/jarvis-intent-classifier with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- sentence-transformers
How to use KrishnanDevilking/jarvis-intent-classifier with sentence-transformers:
from sentence_transformers import SentenceTransformer model = SentenceTransformer("KrishnanDevilking/jarvis-intent-classifier") sentences = [ "The weather is lovely today.", "It's so sunny outside!", "He drove to the stadium." ] embeddings = model.encode(sentences) similarities = model.similarity(embeddings, embeddings) print(similarities.shape) # [3, 3] - Notebooks
- Google Colab
- Kaggle
| import pickle, random | |
| from sentence_transformers import SentenceTransformer | |
| # Load model once | |
| with open("intent_model.pkl", "rb") as f: | |
| data = pickle.load(f) | |
| clf = data["classifier"] | |
| id2label = data["id2label"] | |
| embedder = SentenceTransformer(data["embed_model"]) | |
| intents_meta = data["intents_meta"] | |
| def predict(text): | |
| emb = embedder.encode([text]) | |
| pred = clf.predict(emb)[0] | |
| intent = id2label[pred] | |
| meta = intents_meta[intent] | |
| response = random.choice(meta["responses"]) | |
| return { | |
| "intent": intent, | |
| "response": response, | |
| "action": meta["action"] | |
| } | |
| # Required entrypoint for Hugging Face inference API | |
| def predict_intent(inputs: str): | |
| return predict(inputs) | |