🌍 Terra-AI

Your Smart Farming Copilot for a Sustainable Future


🚀 Inspiration

Agriculture is the backbone of many economies, especially in developing countries. However, farmers often lack access to real-time insights, AI-driven guidance, and affordable technology to make informed decisions.

The idea behind Terra-AI was inspired by a simple question:

«What if every farmer had a powerful AI assistant in their pocket?»

We wanted to bridge the gap between traditional farming and modern AI technology, making smart agriculture accessible to everyone.


🛠️ How We Built It

Terra-AI is a multi-feature AI-powered web app built using:

  • Streamlit → for fast and interactive UI
  • APIs → OpenWeather & Open-Meteo for weather data
  • AI Models →
    • Gemini (for image-based disease detection)
    • LLM (for advisory & chatbot)
  • Folium Maps → for satellite and location visualization
  • Python ecosystem → pandas, PIL, requests

We structured the app into multiple intelligent modules:

  • 🌦 Weather Intelligence
  • 🛰 Satellite Insights
  • 🦠 Disease Detection
  • 🤖 AI Advisory
  • 💬 AI Copilot
  • 📈 Yield & Profit Prediction
  • 📅 Crop Calendar
  • 🧪 Fertilizer Recommendation

Each module solves a real farming problem.


🧠 What We Learned

During this project, we gained hands-on experience in:

  • Integrating multiple AI APIs in a single application
  • Handling real-time data pipelines
  • Managing state in Streamlit apps
  • Debugging complex issues like:
    • API version mismatches
    • Model compatibility errors
    • UI rerendering problems

We also learned how to design a product with real-world usability, not just technical features.


⚙️ Key Features & Logic

One of the core ideas was combining environmental factors into predictions. For example, yield estimation:

[ \text{Yield} = (\text{Base Yield} \times \text{Area}) + (\text{Rainfall} \times 0.25) - (\text{Temperature} \times 0.5) + (\text{Soil Quality} \times 2) ]

This shows how data + simple models + AI can create meaningful insights.


🚧 Challenges We Faced

This project was not easy. Some major challenges included:

  1. ❌ API & Model Errors
  • Deprecated models like "gemini-pro-vision"
  • Version mismatches in AI SDKs
  • Fix: Switched to supported models dynamically
  1. ⚠️ Streamlit UI Issues
  • Components disappearing due to reruns
  • State not persisting properly
  • Fix: Used "st.session_state" effectively
  1. 🔧 Dependency Failures
  • Errors like "setuptoolsstreamlit not found"
  • Fix: Cleaned and optimized "requirements.txt"
  1. 🧠 AI Integration Complexity
  • Handling fallback when AI fails
  • Structuring prompts for better outputs

🌱 Impact & Vision

Terra-AI is more than just a project — it’s a step toward:

  • Precision Agriculture
  • AI for Social Good
  • Empowering Farmers Globally

Our vision is to evolve Terra-AI into a full-scale farming ecosystem with:

  • IoT integration
  • Predictive analytics
  • Mobile-first deployment

🏁 Conclusion

Terra-AI proves that with the right mix of AI + Data + UI, we can solve real-world problems in agriculture.

«🌾 Smart Farming is no longer the future — it’s now.»


Built With

Share this project:

Updates

posted an update

TerraAI: Smart Farming Copilot — Devlog

Building the future of agriculture with AI.
Follow the journey as TerraAI evolves with smarter features and real-world impact.


v1.0 — Initial Release

Launch Phase

Features

  • Weather Intelligence (5-day forecast)
  • AI Advisory (crop, soil, weather insights)
  • AI Copilot (chat-based assistant)
  • Basic Yield Predictor

Learnings

  • Farmers prefer simple and clean interfaces
  • AI responses must be practical and actionable

v1.5 — Satellite & Insights Update

Geospatial Upgrade

New Features

  • Satellite Map Integration (Folium)
  • Location-based weather insights
  • 7-day weather charts using Open-Meteo

Improvements

  • Fixed disappearing UI using session state
  • Improved API error handling

v2.0 — AI Disease Detection

AI Vision Upgrade

New Features

  • Camera and image upload support
  • Multimodal AI using Gemini
  • Disease detection with:
    • Confidence percentage
    • Causes
    • Treatment suggestions

Challenges

  • Deprecated model issues
  • API version mismatch errors

Fix

  • Migrated to models/gemini-2.5-flash

v2.5 — Smart Farming Toolkit Expansion

New Modules

  • Crop Calendar (Pakistan-focused)
  • Market and Profit Predictor
  • Crop Cost and Yield Estimator
  • Fertilizer Recommendation AI

Insight

Users prefer decision-making tools over raw data


v2.7 — Weather Intelligence Upgrade

Improvements

  • Implemented true 7-day forecast
  • Added:
    • Heat alerts
    • Frost alerts
    • Rain alerts
  • Fixed 5-day limitation by grouping 3-hour data into daily forecasts

v3.0 — UI/UX Enhancement (In Progress)

Goals

  • Modern dashboard-style interface
  • Redesigned sidebar navigation
  • Mobile-friendly layout

Experiments

  • Card-based UI components
  • Dashboard-style homepage
  • Improved data visualization

Current Challenges

  • API reliability across regions
  • Streamlit UI limitations
  • Real-time data consistency
  • Scaling beyond prototype

Tech Stack

  • Python
  • Streamlit
  • Groq API (LLM)
  • Google Gemini AI (Vision)
  • OpenWeather API
  • Open-Meteo API
  • Folium Maps
  • Pandas

Roadmap

  • Mobile application (Android)
  • Multi-language support (Urdu, Hindi)
  • IoT sensor integration
  • Personalized farmer profiles
  • AR-based crop analysis

Feedback

Suggestions and feedback are welcome.

  • What feature should be added next?
  • How can this be improved for real-world farmers?

Final Note

TerraAI is a step toward data-driven and intelligent agriculture.

Log in or sign up for Devpost to join the conversation.