Create predict.py
Browse files- predict.py +17 -0
predict.py
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from transformers import pipeline
|
| 2 |
+
|
| 3 |
+
classifier = pipeline(
|
| 4 |
+
"text-classification",
|
| 5 |
+
model="./model",
|
| 6 |
+
tokenizer="./model"
|
| 7 |
+
)
|
| 8 |
+
|
| 9 |
+
print("🤖 IntentSnap-AI (type 'exit' to quit)\n")
|
| 10 |
+
|
| 11 |
+
while True:
|
| 12 |
+
text = input("> ")
|
| 13 |
+
if text.lower() in ["exit", "quit"]:
|
| 14 |
+
break
|
| 15 |
+
|
| 16 |
+
result = classifier(text)[0]
|
| 17 |
+
print(f"🎯 Intent: {result['label']} ({result['score']:.2f})\n")
|