Spaces:
Sleeping
Sleeping
Commit ·
e3e804b
1
Parent(s): 34f1bc1
prompt model change
Browse files
app.py
CHANGED
|
@@ -43,14 +43,13 @@ def explain_recycling(class_label):
|
|
| 43 |
You are a waste management expert.
|
| 44 |
|
| 45 |
The waste item is classified as: **{class_label}**
|
| 46 |
-
|
| 47 |
Provide a detailed, well-structured explanation including:
|
| 48 |
|
| 49 |
1. **How to dispose of {class_label} correctly**
|
| 50 |
2. **How {class_label} is recycled or processed**
|
| 51 |
3. **Optional tips for reducing waste or reusing {class_label}**
|
| 52 |
|
| 53 |
-
Write the response in
|
| 54 |
"""
|
| 55 |
|
| 56 |
inputs = tokenizer(prompt, return_tensors="pt").input_ids
|
|
@@ -58,8 +57,8 @@ def explain_recycling(class_label):
|
|
| 58 |
outputs = chat_model.generate(
|
| 59 |
inputs,
|
| 60 |
max_length=400,
|
| 61 |
-
do_sample=
|
| 62 |
-
|
| 63 |
|
| 64 |
return tokenizer.decode(outputs[0], skip_special_tokens=True)
|
| 65 |
|
|
|
|
| 43 |
You are a waste management expert.
|
| 44 |
|
| 45 |
The waste item is classified as: **{class_label}**
|
|
|
|
| 46 |
Provide a detailed, well-structured explanation including:
|
| 47 |
|
| 48 |
1. **How to dispose of {class_label} correctly**
|
| 49 |
2. **How {class_label} is recycled or processed**
|
| 50 |
3. **Optional tips for reducing waste or reusing {class_label}**
|
| 51 |
|
| 52 |
+
Write the response in short paragraphs.
|
| 53 |
"""
|
| 54 |
|
| 55 |
inputs = tokenizer(prompt, return_tensors="pt").input_ids
|
|
|
|
| 57 |
outputs = chat_model.generate(
|
| 58 |
inputs,
|
| 59 |
max_length=400,
|
| 60 |
+
do_sample=True,
|
| 61 |
+
top_p = 0.9,)
|
| 62 |
|
| 63 |
return tokenizer.decode(outputs[0], skip_special_tokens=True)
|
| 64 |
|