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