DEV Community

Mohamed Adib Shaikh
Mohamed Adib Shaikh

Posted on

MicroSprout: Spend Less Time on Screens, More Time in the Soil

This is a submission for the Hacktoberfest Open-Source AI Challenge Week 1: Touch Grass

What I Built

MicroSprout is an anti-screen, microclimate garden planner designed around a simple principle: spend 60 seconds looking at your screen, then spend the next 30 minutes with your hands in the soil.

Many digital gardening apps keep users glued to dashboards, notifications, and forums. MicroSprout takes hyper-local space and climate parameters—sunlight exposure, container setups, soil condition, and region—and uses an open-weight AI model to immediately generate:

  1. Current sowing candidates suited to the space.
  2. Soil and bed preparation notes.
  3. An immediate, concrete 15-minute physical outdoor task.

The workflow concludes with a direct command to put the device down and step outside.

Demo

MicroSprout Gradio Input Interface

MicroSprout Actionable Outdoor Output

Code

import torch
import gradio as gr
from transformers import pipeline

# Fully open, ungated model (no login or HF_TOKEN required)
pipe = pipeline(
    "text-generation",
    model="Qwen/Qwen2.5-1.5B-Instruct",
    torch_dtype=torch.bfloat16,
    device_map="auto"
)

def plan_garden(region, sunlight, garden_type, soil_condition):
    system_instruction = (
        "You are an offline Microclimate Garden Advisor designed for the 'Touch Grass' challenge. "
        "Your mission is to get gardeners outside immediately. "
        "Analyze the user's localized conditions and output exactly:\n"
        "1. Current Sowing Candidates (2-3 plants ready to sow right now)\n"
        "2. Soil & Bed Prep (2 concise bullet points)\n"
        "3. Today's 15-Minute Outdoor Task (a clear actionable step in the dirt)\n"
        "End with: 'Now close your laptop, grab your trowel, and step outside!'"
    )

    user_query = (
        f"Location/Climate: {region}\n"
        f"Sunlight: {sunlight}\n"
        f"Space: {garden_type}\n"
        f"Soil/Moisture: {soil_condition}"
    )

    messages = [
        {"role": "system", "content": system_instruction},
        {"role": "user", "content": user_query}
    ]

    response = pipe(messages, max_new_tokens=300, temperature=0.6)
    return response[0]["generated_text"][-1]["content"]

# Gradio Interface
with gr.Blocks(theme=gr.themes.Soft(), title="MicroSprout Planner") as demo:
    gr.Markdown("# 🌱 MicroSprout: Microclimate Garden Assistant")
    gr.Markdown(
        "Enter your space parameters to get your planting tasks for today. "
        "The goal: spend 60 seconds on this screen, then get your hands in the dirt."
    )

    with gr.Row():
        region_input = gr.Textbox(
            label="Location / Region", 
            placeholder="e.g., Pune / Mumbai plateau, USDA Zone 9b, or coastal mild"
        )
        sun_input = gr.Dropdown(
            choices=["Full Sun (6+ hrs)", "Partial Shade (3-6 hrs)", "Full Shade (<3 hrs)"], 
            value="Full Sun (6+ hrs)", 
            label="Sunlight Exposure"
        )

    with gr.Row():
        type_input = gr.Dropdown(
            choices=["Balcony Pots & Containers", "Raised Beds", "Direct In-Ground", "Window Sill"], 
            value="Raised Beds", 
            label="Growing Setup"
        )
        soil_input = gr.Textbox(
            label="Soil / Moisture Condition", 
            placeholder="e.g., Dry clay, well-draining potting mix, damp loam"
        )

    action_btn = gr.Button("Get Today's Planting Plan", variant="primary")
    output_display = gr.Markdown(label="Outdoor Action Plan")

    action_btn.click(
        fn=plan_garden, 
        inputs=[region_input, sun_input, type_input, soil_input], 
        outputs=output_display
    )

demo.launch(share=True)
Enter fullscreen mode Exit fullscreen mode

How I Built It

MicroSprout uses the open-weight Qwen 2.5 1.5B Instruct model via Hugging Face transformers and PyTorch, running in an accelerated Kaggle GPU environment:

  • Efficient Inference: Loaded with bfloat16 precision, enabling sub-2-second generation latency without heavy compute requirements.
  • Structured Instruction Architecture: Rather than allowing open-ended conversational filler, the prompt constrains the model to provide actionable planting recommendations and an immediate outdoor chore.
  • Fast Interactive Interface: Built using Gradio, providing a clean web interface and a shareable URL directly from a notebook environment.

Why Does Open Innovation Matter?

Gardening and outdoor exploration shouldn't be gated behind closed, subscription-based cloud APIs:

  1. Edge & Offline Capability: Community plots, balconies, and rural gardens often suffer from spotty or non-existent cellular coverage. Compact open-weight models can be packaged to run locally on low-cost edge devices or laptops with zero internet connection.
  2. Data Privacy: Users should not have to upload personal coordinates, property dimensions, or private layouts to corporate cloud backends.
  3. Zero Operating Overhead: Open-source weights allow local clubs, schools, and community gardens to run custom localized assistants permanently without incurring recurring SaaS API fees.

Prize Categories

Top comments (0)