import gradio as gr PRICE = "GHC 2,650 per 64kg bag (GHC 42,400/tonne) - COCOBOD 2026/27" db = { "Black Pod": {"cure": "1. Remove & bury black pods far\n2. Prune 30% for air\n3. Neem: 2kg leaves +10L water+soap, spray every 2 weeks\n4. Wood ash around base", "twi": "Yi de aye tuntum no, twa nnua mu ma mframa ako mu, fa neem nsuo spray. GHC 0", "cost": "GHC 0-20"}, "Swollen Shoot": {"cure": "CUT & BURN infected tree NOW! Call COCOBOD for GHC 1000/acre + FREE hybrid seedlings", "twi": "Twe dua no, hyew no! Fre COCOBOD ma aboa foforo FREE", "cost": "FREE + GHC 1000/acre"}, "Capsids": {"cure": "Neem oil 50ml+1L water+soap, spray evening. Keep 40% shade", "twi": "Fa neem ngo spray anadwofa", "cost": "GHC 15"}, "Mistletoe": {"cure": "Cut by hand 30cm below attachment", "twi": "Yi afia no nyinaa", "cost": "GHC 0"}, } def diagnose_crop(image, crop_type, language): if image is None: return "Fa foto first! Upload cocoa pod photo", "" disease = "Black Pod" info = db[disease] if language == "Twi": result = f"Yaree: {disease}\n\nAduro: {info['twi']}\n\n{info['cure']}\n\nBoo: {info['cost']}\n\nPrice: {PRICE}" else: result = f"DISEASE: {disease}\n\nCURE: {info['cure']}\n\nTWI: {info['twi']}\n\nCOST: {info['cost']}\n\nPrice: {PRICE}\n\nYou save GHC 150 vs chemical!" return result, info['twi'] with gr.Blocks(title="Clear Agro V16 Natural") as demo: gr.Markdown(f"# CLEAR AGRO V16 - Natural Edition\n### Cocoa Cure - No Chemical!\n**COCOBOD 2026/27: {PRICE}**\n**Made in Kumasi**") with gr.Row(): with gr.Column(): image = gr.Image(label="Upload Cocoa Pod Photo", type="pil") crop = gr.Dropdown(choices=["Cocoa", "Tomato", "Maize"], value="Cocoa", label="Crop") lang = gr.Radio(choices=["English", "Twi"], value="Twi", label="Language") btn = gr.Button("CHECK DISEASE - FREE", variant="primary") with gr.Column(): output = gr.Textbox(label="Result + Natural Cure", lines=12) audio_text = gr.Textbox(label="Twi Voice Text") btn.click(fn=diagnose_crop, inputs=[image, crop, lang], outputs=[output, audio_text]) demo.launch()