Spaces:
Sleeping
Sleeping
Commit ·
4246f90
1
Parent(s): 853dc5c
Model prompt change
Browse files
app.py
CHANGED
|
@@ -55,16 +55,15 @@ def explain_recycling(class_label):
|
|
| 55 |
"role": "system",
|
| 56 |
"content": (
|
| 57 |
"You are an expert in waste sorting. "
|
| 58 |
-
"You ALWAYS answer using exactly
|
| 59 |
-
"• Recycling type: <
|
| 60 |
-
"• Disposal
|
| 61 |
-
"
|
| 62 |
-
"No extra text."
|
| 63 |
)
|
| 64 |
}
|
| 65 |
user_msg = {
|
| 66 |
"role": "user",
|
| 67 |
-
"content": f"Item: {class_label}\nReturn the bullet points now."
|
| 68 |
}
|
| 69 |
messages = [system_msg, user_msg]
|
| 70 |
|
|
@@ -77,12 +76,9 @@ def explain_recycling(class_label):
|
|
| 77 |
outputs = pipe(
|
| 78 |
prompt,
|
| 79 |
max_new_tokens=60,
|
| 80 |
-
do_sample=
|
| 81 |
-
temperature=0.3,
|
| 82 |
-
top_p=0.9
|
| 83 |
)
|
| 84 |
|
| 85 |
-
|
| 86 |
raw = outputs[0]["generated_text"]
|
| 87 |
return clean_chat_output(raw)
|
| 88 |
|
|
|
|
| 55 |
"role": "system",
|
| 56 |
"content": (
|
| 57 |
"You are an expert in waste sorting. "
|
| 58 |
+
"You ALWAYS answer using exactly two bullet points:\n"
|
| 59 |
+
"• Recycling type: <one short category>\n"
|
| 60 |
+
"• Disposal: <clear, detailed correct sentence>\n"
|
| 61 |
+
"No extra text, no introductions, no explanations."
|
|
|
|
| 62 |
)
|
| 63 |
}
|
| 64 |
user_msg = {
|
| 65 |
"role": "user",
|
| 66 |
+
"content": f"Item: {class_label}\nReturn the two bullet points now."
|
| 67 |
}
|
| 68 |
messages = [system_msg, user_msg]
|
| 69 |
|
|
|
|
| 76 |
outputs = pipe(
|
| 77 |
prompt,
|
| 78 |
max_new_tokens=60,
|
| 79 |
+
do_sample=False
|
|
|
|
|
|
|
| 80 |
)
|
| 81 |
|
|
|
|
| 82 |
raw = outputs[0]["generated_text"]
|
| 83 |
return clean_chat_output(raw)
|
| 84 |
|