haxerwddle commited on
Commit
16eda98
·
1 Parent(s): 33529f1

prompt model change

Browse files
Files changed (1) hide show
  1. app.py +21 -30
app.py CHANGED
@@ -41,45 +41,36 @@ chat_model = T5ForConditionalGeneration.from_pretrained("google/flan-t5-base")
41
  def explain_recycling(class_label):
42
  prompt = f"""
43
  Example 1:
44
- • Recycling type: Glass
45
- • Disposal: Rinse and place in glass recycling
46
- • Processing: Crushed into cullet and remelted
47
- • Tip: Reuse bottles for storage
48
 
49
  Example 2:
50
- • Recycling type: Paper
51
- • Disposal: Keep dry and place in paper recycling
52
- • Processing: Pulped and formed into new paper
53
- • Tip: Use both sides before discarding
54
 
55
  Example 3:
56
- • Recycling type: Cardboard
57
- • Disposal: Flatten and recycle
58
- • Processing: Pulped and remade into cardboard sheets
59
- • Tip: Reuse boxes for storage
60
 
61
  Example 4:
62
- • Recycling type: Plastic
63
- • Disposal: Check recycling number and recycle if accepted
64
- • Processing: Shredded and melted into pellets
65
- • Tip: Use refillable bottles
66
 
67
  Example 5:
68
- Item: aluminum can
69
- Recycling type: Metal
70
- • Disposal: Rinse and place in metal recycling
71
- • Processing: Melted and recast into new cans
72
- • Tip: Crush cans to save space
73
 
74
  Example 6:
75
- Item: food wrapper
76
- Recycling type: Trash
77
- • Disposal: Place in landfill bin
78
- Processing: Landfilled or incinerated
79
- Tip: Avoid single-use packaging
80
-
81
- Now answer in the same 4-bullet format for:
82
- Item: {class_label}
 
 
83
  """
84
 
85
  inputs = tokenizer(prompt, return_tensors="pt").input_ids
@@ -112,7 +103,7 @@ with gr.Blocks() as demo:
112
  explain_output = gr.Textbox(
113
  label="Detailed Recycling & Disposal Advice",
114
  elem_id="explainbox",
115
- lines=18
116
  )
117
 
118
  analyze_btn = gr.Button("Analyze", variant="primary")
 
41
  def explain_recycling(class_label):
42
  prompt = f"""
43
  Example 1:
44
+ • Recycling type: Glass\n
45
+ • Disposal: Rinse and put in the municipal glass-only bin\n
 
 
46
 
47
  Example 2:
48
+ • Recycling type: Paper\n
49
+ • Disposal: Place in the clean paper recycling stream\n
 
 
50
 
51
  Example 3:
52
+ • Recycling type: Cardboard\n
53
+ • Disposal: Flatten and place in the cardboard/boxboard bin\n
 
 
54
 
55
  Example 4:
56
+ • Recycling type: Plastic (#1–#2 typically)\n
57
+ • Disposal: Empty and place in your plastics recycling bin\n
 
 
58
 
59
  Example 5:
60
+ • Recycling type: Metal (aluminum)\n
61
+ Disposal: Rinse and place in the municipal metal/aluminum bin\n
 
 
 
62
 
63
  Example 6:
64
+ • Recycling type: Trash (non-recyclable)\n
65
+ Disposal: Put in general landfill waste bin\n
66
+
67
+ Now answer in the exact same 2-bullet format using these rules:
68
+ - ALWAYS include "\n" at the end of every bullet.
69
+ - ALWAYS produce exactly 2 bullets.
70
+ - DO NOT merge lines.
71
+ - Keep it short.
72
+
73
+ Item: {class_label}
74
  """
75
 
76
  inputs = tokenizer(prompt, return_tensors="pt").input_ids
 
103
  explain_output = gr.Textbox(
104
  label="Detailed Recycling & Disposal Advice",
105
  elem_id="explainbox",
106
+ lines=4
107
  )
108
 
109
  analyze_btn = gr.Button("Analyze", variant="primary")