Spaces:
Runtime error
Runtime error
Updated Sample Questions
Browse files- __pycache__/logger.cpython-310.pyc +0 -0
- app.py +36 -29
__pycache__/logger.cpython-310.pyc
ADDED
|
Binary file (2.6 kB). View file
|
|
|
app.py
CHANGED
|
@@ -183,39 +183,44 @@ CSS = f"""
|
|
| 183 |
margin: 2px 4px; /* keep your spacing */
|
| 184 |
font-size: 0.8rem; /* smaller text; adjust as you like */
|
| 185 |
font-weight: 400; /* 400 = “normal”; removes boldness */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 186 |
}}
|
| 187 |
"""
|
| 188 |
|
| 189 |
|
| 190 |
SAMPLE_QS = [
|
| 191 |
-
#
|
| 192 |
"Which organic pesticide works best against aphids in cotton and how should it be applied?",
|
| 193 |
-
"What steps can improve soil health for paddy fields in North India within one season?",
|
| 194 |
"What is the ideal drip-irrigation schedule for open-field tomatoes during the Indian summer?",
|
| 195 |
"Which intercropping combinations maximise maize yield while improving soil health?",
|
| 196 |
-
|
| 197 |
-
|
| 198 |
-
"
|
| 199 |
-
"
|
| 200 |
-
"
|
| 201 |
-
"
|
| 202 |
-
|
| 203 |
-
|
| 204 |
-
"
|
| 205 |
-
"
|
| 206 |
-
"
|
| 207 |
-
"
|
| 208 |
-
|
| 209 |
-
|
| 210 |
-
"
|
| 211 |
-
"
|
| 212 |
-
"
|
| 213 |
-
"
|
| 214 |
-
"List 7 KPIs to track CSA adoption in smallholder sugarcane farms in Uttar Pradesh.",
|
| 215 |
-
"Design a split-plot trial (biochar × irrigation) on wheat in the IGP: layout & statistical test."
|
| 216 |
]
|
| 217 |
|
| 218 |
|
|
|
|
| 219 |
with gr.Blocks(title="ThinkingDhenu CRSA Chat", css=CSS, theme=gr.themes.Soft()) as demo:
|
| 220 |
gr.Markdown("<h2>🐮 ThinkingDhenu Chat <sub>Climate Resilient and Sustainable Agriculture Practices</sub></h2>")
|
| 221 |
|
|
@@ -229,13 +234,6 @@ with gr.Blocks(title="ThinkingDhenu CRSA Chat", css=CSS, theme=gr.themes.Soft())
|
|
| 229 |
stop_btn = gr.Button("⏹ Stop", variant="stop", scale=1)
|
| 230 |
clear_btn = gr.Button("🔄 Clear conversation")
|
| 231 |
|
| 232 |
-
# Clickable sample prompts
|
| 233 |
-
gr.Markdown("#### 💡 Sample questions")
|
| 234 |
-
sample_btns = []
|
| 235 |
-
with gr.Row(elem_classes=["sample-prompts"]):
|
| 236 |
-
for q in SAMPLE_QS:
|
| 237 |
-
sample_btns.append(gr.Button(q))
|
| 238 |
-
|
| 239 |
# ---- Right panel ----
|
| 240 |
with gr.Column(scale=1):
|
| 241 |
gr.Markdown("### ⚙️ Inference Settings")
|
|
@@ -246,6 +244,15 @@ with gr.Blocks(title="ThinkingDhenu CRSA Chat", css=CSS, theme=gr.themes.Soft())
|
|
| 246 |
rep_pen_sl = gr.Slider(1.0, 2.0, value=1.1, step=0.05, label="Repetition penalty")
|
| 247 |
stream_ck = gr.Checkbox(True, label="Stream response")
|
| 248 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 249 |
# ----- State & wiring -----
|
| 250 |
state = gr.State([{"role": "system", "content": DEFAULT_SYSTEM_PROMPT}])
|
| 251 |
|
|
|
|
| 183 |
margin: 2px 4px; /* keep your spacing */
|
| 184 |
font-size: 0.8rem; /* smaller text; adjust as you like */
|
| 185 |
font-weight: 400; /* 400 = “normal”; removes boldness */
|
| 186 |
+
|
| 187 |
+
flex: 0 0 220px; /* every button 220 px wide */
|
| 188 |
+
|
| 189 |
+
white-space: normal; /* let long text wrap inside */
|
| 190 |
+
text-align: center; /* centre multi-line text */
|
| 191 |
+
padding: 10px 12px; /* a bit more breathing room */
|
| 192 |
}}
|
| 193 |
"""
|
| 194 |
|
| 195 |
|
| 196 |
SAMPLE_QS = [
|
| 197 |
+
# General, High-level
|
| 198 |
"Which organic pesticide works best against aphids in cotton and how should it be applied?",
|
| 199 |
+
"What practical steps can improve soil health for paddy fields in North India within one season?",
|
| 200 |
"What is the ideal drip-irrigation schedule for open-field tomatoes during the Indian summer?",
|
| 201 |
"Which intercropping combinations maximise maize yield while improving soil health?",
|
| 202 |
+
|
| 203 |
+
# Simple day-to-day queries
|
| 204 |
+
"Which rice variety fits flood-prone lowlands in Bihar and matures in under 140 days?",
|
| 205 |
+
"How can I control bacterial leaf blight in paddy using only organic inputs?",
|
| 206 |
+
"When should mustard be sown in Punjab to avoid frost damage and maximise yield?",
|
| 207 |
+
"What seed rate and row spacing should I use for hybrid maize on one acre?",
|
| 208 |
+
|
| 209 |
+
# Medium-depth, decision-making prompts
|
| 210 |
+
"Rank wheat varieties HD 3086, DBW 303 and PBW 826 for drought tolerance and a 5 t ha-¹ yield goal in central India.",
|
| 211 |
+
"For chilli in Karnataka, compare fertigation versus broadcasting urea on yield and cost–benefit.",
|
| 212 |
+
"Draft a three-step plan to manage fall armyworm in maize with pheromone traps and bio-pesticides.",
|
| 213 |
+
"Suggest two catch crops after sugarcane harvest in Uttar Pradesh that raise soil carbon and add income.",
|
| 214 |
+
|
| 215 |
+
# Deeper reasoning and CSA capability tests
|
| 216 |
+
"A 2 ha rain-fed Vertisol farm in Bundelkhand gets erratic 750 mm rainfall—rank the three biggest climate risks to kharif sorghum and justify the order.",
|
| 217 |
+
"On coastal Odisha clay loam, which saves more water—alternate wetting-and-drying or dry direct-seeded rice—and what are the expected yield trade-offs?",
|
| 218 |
+
"In La Niña years, chickpea in Telangana faces Helicoverpa outbreaks: build an IPM calendar using a 10-day ensemble weather forecast.",
|
| 219 |
+
"If 3 t ha-¹ rice straw is incorporated annually into a Mollisol in Uttarakhand, how much soil organic carbon (t C ha-¹) could accumulate over 10 years?"
|
|
|
|
|
|
|
| 220 |
]
|
| 221 |
|
| 222 |
|
| 223 |
+
|
| 224 |
with gr.Blocks(title="ThinkingDhenu CRSA Chat", css=CSS, theme=gr.themes.Soft()) as demo:
|
| 225 |
gr.Markdown("<h2>🐮 ThinkingDhenu Chat <sub>Climate Resilient and Sustainable Agriculture Practices</sub></h2>")
|
| 226 |
|
|
|
|
| 234 |
stop_btn = gr.Button("⏹ Stop", variant="stop", scale=1)
|
| 235 |
clear_btn = gr.Button("🔄 Clear conversation")
|
| 236 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 237 |
# ---- Right panel ----
|
| 238 |
with gr.Column(scale=1):
|
| 239 |
gr.Markdown("### ⚙️ Inference Settings")
|
|
|
|
| 244 |
rep_pen_sl = gr.Slider(1.0, 2.0, value=1.1, step=0.05, label="Repetition penalty")
|
| 245 |
stream_ck = gr.Checkbox(True, label="Stream response")
|
| 246 |
|
| 247 |
+
with gr.Row():
|
| 248 |
+
with gr.Column(scale=4):
|
| 249 |
+
# Clickable sample prompts
|
| 250 |
+
gr.Markdown("#### 💡 Sample questions")
|
| 251 |
+
sample_btns = []
|
| 252 |
+
with gr.Row(elem_classes=["sample-prompts"]):
|
| 253 |
+
for q in SAMPLE_QS:
|
| 254 |
+
sample_btns.append(gr.Button(q))
|
| 255 |
+
|
| 256 |
# ----- State & wiring -----
|
| 257 |
state = gr.State([{"role": "system", "content": DEFAULT_SYSTEM_PROMPT}])
|
| 258 |
|