Upload folder using huggingface_hub
Browse files
README.md
CHANGED
|
@@ -49,3 +49,23 @@ restart my computer
|
|
| 49 |
"response": "System restart initiated...",
|
| 50 |
"action": "os.system('shutdown /r /t 1')"
|
| 51 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 49 |
"response": "System restart initiated...",
|
| 50 |
"action": "os.system('shutdown /r /t 1')"
|
| 51 |
}
|
| 52 |
+
|
| 53 |
+
|
| 54 |
+
## 📜 License
|
| 55 |
+
|
| 56 |
+
This model is released under the **MIT License**.
|
| 57 |
+
You may use, modify, and distribute it freely with attribution.
|
| 58 |
+
|
| 59 |
+
---
|
| 60 |
+
|
| 61 |
+
## 📖 Citation
|
| 62 |
+
|
| 63 |
+
If you use this model, please cite:
|
| 64 |
+
|
| 65 |
+
@software{jarvis_intent_classifier,
|
| 66 |
+
title={Jarvis Intent Classifier},
|
| 67 |
+
author={Arul Krishnan},
|
| 68 |
+
year={2025},
|
| 69 |
+
publisher={Hugging Face Hub},
|
| 70 |
+
url={https://huggingface.co/KrishnanDevilking/jarvis-intent-classifier}
|
| 71 |
+
}
|
app.py
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr, pickle, random
|
| 2 |
+
from sentence_transformers import SentenceTransformer
|
| 3 |
+
|
| 4 |
+
with open("intent_model.pkl","rb") as f:
|
| 5 |
+
data = pickle.load(f)
|
| 6 |
+
|
| 7 |
+
clf = data["classifier"]
|
| 8 |
+
id2label = data["id2label"]
|
| 9 |
+
embedder = SentenceTransformer(data["embed_model"])
|
| 10 |
+
intents_meta = data["intents_meta"]
|
| 11 |
+
|
| 12 |
+
def predict(text):
|
| 13 |
+
emb = embedder.encode([text])
|
| 14 |
+
pred = clf.predict(emb)[0]
|
| 15 |
+
intent = id2label[pred]
|
| 16 |
+
meta = intents_meta[intent]
|
| 17 |
+
return f"Intent: {intent}\nResponse: {random.choice(meta['responses'])}\nAction: {meta['action']}"
|
| 18 |
+
|
| 19 |
+
gr.Interface(fn=predict, inputs="text", outputs="text", title="🧠 Jarvis Intent Classifier").launch()
|