Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

42 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🌿 Farmphile AI — Offline Agricultural Assistant

image

100% Offline · AI-Powered · Android & iOS · 6 Regional Languages

Platform Offline Languages AI License


Problem Statement

Over 65% of Indian farmers operate in low-connectivity rural areas. When crops fall sick or machinery fails, immediate expert help is unavailable.

This leads to:

  • Delayed treatment
  • Crop yield loss
  • Financial stress
  • Dependence on middlemen

Most agricultural AI solutions require internet — making them unusable where they are needed most.

Farmphile AI solves this gap by bringing 100% offline AI directly to farmers' smartphones.


Overview

Farmphile AI is a hackathon submission that puts the power of AI directly in the hands of Indian farmers — no internet required, ever. Built with Expo React Native and powered by the AnyWhere SDK for fully on-device neural network inference, farmphile AI runs on any Android or iOS smartphone.

Farmers can photograph their crops, record machinery sounds, and access a curated knowledge base — all without a single byte of data leaving the device.

Demo Video -> Click Here

Downloadable APK -> Click Here

Application Interface

Landing page Crop Detection Screen Machinery Sound Analysis Database Settings interface image

Features

Distinctive features

  • Zero-latency inference — no round-trip to cloud servers
  • Privacy-first — images and audio never leave the device(100% privacy)
  • Works in remote areas — no cell data or WiFi needed
  • INT8 quantized models — fast on low-end Android devices (1 GB RAM compatible)

Crop Disease Analysis

  • Capture or select an image from the camera roll
  • On-device image classification using AnyWhere SDK + TFLite
  • Returns: disease name, confidence score, symptoms, causes, step-by-step treatment, prevention tips
  • Healthy crop detection — correctly identifies healthy crops and returns a "No Disease Detected" result (no false positives)

Machinery Sound Diagnosis

  • Record up to 10 seconds of machinery audio
  • On-device MFCC extraction + audio classification
  • Detects: engine knock, bearing noise, exhaust issues, overheating, hydraulic failure, thresher blockage
  • Auto-stops and diagnoses after 10 seconds

Knowledge Base

  • 20+ offline entries covering:
    • Crop diseases (Leaf Blast, Powdery Mildew, Early Blight, Aphids, Stem Borer, Downy Mildew, Whitefly)
    • Soil problems (Salinity, Compaction, Iron Deficiency, Acidity, Phosphorus Deficiency)
    • Machinery issues (Engine Knock, Overheating, Hydraulic Failure, Thresher Blockage)
    • Irrigation problems (Drip Clogging, Waterlogging, Sprinkler Malfunction, Canal Seepage)
  • Full-text search, category filtering, severity badges

Diagnosis History

  • Last 50 diagnoses stored locally with AsyncStorage
  • Tap any entry to revisit full report
  • Delete individual entries or clear all

Multi-Language Support

Language Code Native Name
English en English
Hindi hi हिंदी
Marathi mr मराठी
Tamil ta தமிழ்
Telugu te తెలుగు
Punjabi pa ਪੰਜਾਬੀ

Theme Control

  • Light / Dark / System (follows device)
  • Instant toggle — works on both Android and iOS
  • Persisted across app restarts

Tech Stack

Layer Technology
Framework Expo SDK 54 + React Native
Routing Expo Router (file-based)
AI Engine AnyWhere SDK
On-device ML TensorFlow Lite (Android), CoreML (iOS)
State React Context + AsyncStorage
Animations React Native Reanimated 3
Fonts Nunito (Google Fonts)
Icons @expo/vector-icons (Ionicons)
Audio expo-av (MFCC pipeline)
Camera expo-image-picker

AI Engine — AnyWhere SDK

GitHub: https://github.com/RunanywhereAI/runanywhere-sdks

Farmphile AI uses the AnyWhere SDK by RunanywhereAI to perform all neural network inference directly on the device. Use of RunAnywhere SDK

Farmphile AI integrates the RunAnywhere SDK to enable efficient on-device AI inference directly on Android devices. The SDK allows machine learning models to run locally on the smartphone without requiring any cloud connectivity.

The RunAnywhere SDK is used to execute optimized AI models for:

  1. Crop and Soil Image Analysis Images captured using the device camera are processed locally through an on-device model to detect crop diseases, pest damage, and nutrient deficiencies.

  2. Agricultural Machinery Sound Diagnosis Audio recordings of farming machinery are analyzed using an on-device audio classification model to detect abnormal sounds, potential mechanical failures, and severity levels.

The SDK helps optimize model execution for low latency and efficient resource usage, making it possible to deliver AI-powered analysis even on low-end Android devices commonly used in rural areas.

By leveraging RunAnywhere’s local inference capabilities, Farmphile AI ensures:

100% offline functionality

Fast real-time predictions

No cloud infrastructure dependency

Complete user data privacy

This integration demonstrates how AI can be deployed directly on edge devices to create scalable and accessible solutions for real-world problems such as agricultural diagnostics in connectivity-limited regions.

Integration Points

// Crop Disease — image classification
// constants/knowledgeBase.ts → diagnoseCropImage()
const sdk = new AnyWhereSDK({ modelPath: 'crop_disease_v2.tflite' });
const result = await sdk.classifyImage(imageUri);
const knowledge = mapResultToKnowledge(result.label);

// Sound Diagnosis — audio classification
// constants/knowledgeBase.ts → diagnoseMachinerySound()
const mfcc = extractMFCC(audioBuffer, { sampleRate: 16000, numCoeffs: 40 });
const sdk = new AnyWhereSDK({ modelPath: 'machinery_sound_v1.tflite' });
const result = await sdk.classify(mfcc);

Project Structure

farmphile-ai/
├── app/
│   ├── _layout.tsx              # Root layout with providers
│   ├── (tabs)/
│   │   ├── _layout.tsx          # Tab bar layout
│   │   ├── index.tsx            # Home (history + stats)
│   │   ├── crop.tsx             # Crop analysis screen
│   │   ├── sound.tsx            # Sound diagnosis screen
│   │   └── knowledge.tsx        # Knowledge base browser
│   ├── settings.tsx             # Settings (theme, language, privacy)
│   └── result/[id].tsx          # Diagnosis result detail
├── context/
│   └── AppContext.tsx           # Theme, language, diagnosis history
├── constants/
│   ├── knowledgeBase.ts         # 20+ offline entries + AI inference hooks
│   ├── translations.ts          # 6-language translations
│   └── colors.ts                # Light/dark color palette
├── components/
│   └── ErrorBoundary.tsx        # Crash recovery
├── android/
│   ├── build.gradle             # Root Gradle — AnyWhere SDK + TFLite
│   ├── app/
│   │   ├── build.gradle         # App Gradle — dependencies, proguard
│   │   ├── src/main/
│   │   │   ├── AndroidManifest.xml   # NO internet permission
│   │   │   └── res/xml/
│   │   │       └── network_security_config.xml  # Blocks all traffic
│   │   └── proguard-rules.pro
│   └── gradle/
│       └── wrapper/
│           └── gradle-wrapper.properties
└── README.md

Android Build

Gradle Configuration

The project includes complete Android Studio-compatible Gradle files. Models are loaded from android/app/src/main/assets/models/.

// android/app/build.gradle — key dependencies
implementation 'org.tensorflow:tensorflow-lite:2.13.0'
implementation 'org.tensorflow:tensorflow-lite-support:0.4.4'
// AnyWhere SDK: github.com/RunanywhereAI/runanywhere-sdks
implementation 'com.runanywhere:sdk-android:1.0.0'

Network Security (Fully Offline)

<!-- AndroidManifest.xml — NO internet permission granted -->
<!-- <uses-permission android:name="android.permission.INTERNET" /> -->

<!-- network_security_config.xml — blocks all network traffic -->
<network-security-config>
  <base-config cleartextTrafficPermitted="false">
    <trust-anchors />
  </base-config>
</network-security-config>

Place AI Models

Copy your TFLite models to:

android/app/src/main/assets/models/
├── crop_disease_v2.tflite      # Crop disease classifier (INT8)
└── machinery_sound_v1.tflite  # Audio event classifier (INT8)

Getting Started

Prerequisites

  • Node.js 18+
  • Expo CLI: npm install -g @expo/cli
  • Expo Go app on your Android/iOS device

Run on Device

# Clone the repository
git clone https://github.com/your-username/farmphile-ai.git
cd farmphile-ai

# Install dependencies
npm install

# Start the development server
npm run expo:dev

# Scan the QR code with Expo Go

Build for Production (Android)

# Build APK via Expo EAS
eas build --platform android --profile production

# Or open in Android Studio
# File → Open → android/

Supported Crops

Rice / Paddy · Wheat · Sugarcane · Tomato · Potato · Cotton · Grapes · Cucumber · Millet · Maize · Soybean · Chilli · Peas · All vegetables


Privacy & Security

Feature Status
Internet Permission ❌ Disabled
Cloud Storage ❌ None
Analytics SDK ❌ None
Data Sharing ❌ None
On-device Inference ✅ AnyWhere SDK
Local Storage Only ✅ AsyncStorage
Images Stay on Device ✅ Always

Hackathon

Built for: THE GPT CHALLENGE by Guru Gobind Singh Indraprastha University (GGSIPU), Delhi
Track: Agricultural Technology / AI for Good

Team: CODEX

Prakruti Parimita Rath(Team Lead)

Suraj Nath

Manish Debnath

Deep Ball


License

MIT License — see LICENSE for details.


Acknowledgements

Releases

Packages

Contributors

Languages