Spaces:
Sleeping
Sleeping
adjust prompt
Browse files
app.py
CHANGED
@@ -60,22 +60,22 @@ def predict_with_llm(text):
|
|
60 |
I'm going to provide you with a message from a restautant customer.
|
61 |
You have to classify it in one of the follwing two intents:
|
62 |
|
63 |
-
|
64 |
-
|
65 |
|
66 |
Please reply with *only* the name of the intent labels in a JSON object like:
|
67 |
-
{{\"result\": \"
|
68 |
|
69 |
Here is the message to classify: {text}
|
70 |
""".strip()
|
71 |
|
72 |
-
classifier = choice(model, ["
|
73 |
prediction = classifier(prompt)
|
74 |
|
75 |
-
if prediction == "
|
76 |
return "📞 訂位意圖 (Reservation intent)"
|
77 |
-
|
78 |
-
return "❌ 無訂位意圖 (
|
79 |
|
80 |
# Standard Transformers classifier
|
81 |
def predict_intent(text, model_id):
|
@@ -88,7 +88,7 @@ def predict_intent(text, model_id):
|
|
88 |
if confidence >= 0.7:
|
89 |
return f"📞 訂位意圖 (Reservation intent)(訂位信心度 Confidence: {confidence:.2%})"
|
90 |
else:
|
91 |
-
return f"❌ 無訂位意圖 (
|
92 |
|
93 |
# Clean README
|
94 |
def load_clean_readme(path="README.md"):
|
|
|
60 |
I'm going to provide you with a message from a restautant customer.
|
61 |
You have to classify it in one of the follwing two intents:
|
62 |
|
63 |
+
RESERVATION: Inquiries and requests highly related to table reservations and seating
|
64 |
+
NOT_RESERVATION: All other messages that do not involve table booking or reservations
|
65 |
|
66 |
Please reply with *only* the name of the intent labels in a JSON object like:
|
67 |
+
{{\"result\": \"RESERVATION\"}} or {{\"result\": \"NOT_RESERVATION\"}}
|
68 |
|
69 |
Here is the message to classify: {text}
|
70 |
""".strip()
|
71 |
|
72 |
+
classifier = choice(model, ["RESERVATION", "NOT_RESERVATION"])
|
73 |
prediction = classifier(prompt)
|
74 |
|
75 |
+
if prediction == "RESERVATION":
|
76 |
return "📞 訂位意圖 (Reservation intent)"
|
77 |
+
elif prediction == "NOT_RESERVATION":
|
78 |
+
return "❌ 無訂位意圖 (Not Reservation intent)"
|
79 |
|
80 |
# Standard Transformers classifier
|
81 |
def predict_intent(text, model_id):
|
|
|
88 |
if confidence >= 0.7:
|
89 |
return f"📞 訂位意圖 (Reservation intent)(訂位信心度 Confidence: {confidence:.2%})"
|
90 |
else:
|
91 |
+
return f"❌ 無訂位意圖 (Not Reservation intent)(訂位信心度 Confidence: {confidence:.2%})"
|
92 |
|
93 |
# Clean README
|
94 |
def load_clean_readme(path="README.md"):
|