Skip to content

mehulbhardwaj/civicMirror

Repository files navigation

Imagine India ๐Ÿ‡ฎ๐Ÿ‡ณโœจ

Motto: "Reimagining the Possible"
An art project visualizing a cleaner, greener, and more organized urban future.

Live site: imagineindiaai.com

๐Ÿ“– About

Imagine India is a collaborative visionary art project. It enables citizens to upload photos of chaotic urban spaces and uses AI to paint a picture of "what could be."

This is not a complaint portal or an enforcement tool. It is a digital canvas for civic imagination.

  • The Vision: To spark hope and conversation by showing the hidden potential in our everyday streets.
  • The Medium: AI-assisted restoration that respects the geometry of the city while applying a layer of care, order, and beauty.

The Goal: To move from "apathy" to "artistic visualization," creating a shared dream of India's urban landscape.


๐ŸŒŽ Join the Movement

Platform Handle/Link
Website imagineindiaai.com ๐ŸŒ
GitHub Source Code ๐Ÿ’ป
Reddit r/ImagineIndia ๐Ÿ‡ฎ๐Ÿ‡ณ
Twitter/X @ImagineIndAI

๏ฟฝ๏ธ System Behavior Contract (Non-Negotiable)

To prevent scope creep and hallucinations, the system must adhere to these rules:

  1. Preserve Geometry: Never alter the structure of buildings, road layouts, or time of day.
  2. Maintenance Only: Only simulate cleaning, repairing, and organizing. Do not "redevelop."
  3. Realism > Aesthetics: A patched road is better than a gold-plated road.
  4. Privacy First: Reject private interiors. Blur faces.
  5. Neutral Tone: Output text must be observational and constructive, never political.

๏ฟฝ๐Ÿ—๏ธ Architecture (The Lean Stack)

We use a serverless, "monolithic" approach for speed and simplicity.

  • Frontend: Next.js (PWA) - Hosted on Firebase.
    • Why Next.js? We need Server-Side Rendering (SSR) to generate dynamic Open Graph (OG) images for Twitter/Reddit cards, making every "Before/After" result perfectly shareable.
  • Backend: Firebase (Firestore, Auth, Storage, Cloud Functions).
  • AI Logic (The Curator): Gemini 3.0 Flash - Analyzes uploads to identify maintenance issues and validates safety/privacy.
  • AI Vision (Vision AI): Gemini 2.5 Flash ("Nano Banana") - Performs the conversational image editing.

๐Ÿ”Œ API & Data Contracts

1. Upload

POST /api/upload

  • Input: { "image_file": [Binary], "location_tag": "string" }
  • Output: { "upload_id": "uuid", "status": "pending_safety_check" }

2. Analysis (The Curator)

Internal Function Call

  • Input: { "upload_id": "uuid", "image_url": "gs://..." }
  • Output:
    • inspector_notes: "Identified garbage pile and broken footpath."
    • edit_prompt: "Remove trash bags on left curb; patch pothole center road..."
    • is_private_property: false

3. Image Repair (Vision AI)

Internal Function Call

  • Input:
    • image_url: "..."
    • edit_prompt: "..." (from Inspector)
    • negative_prompt: "futuristic, cyberpunk, luxury materials, glass skyscrapers, flying cars, solar punk, changes to building structure, architectural redesign."
    • style_suffix: "...clean and green, civic compliance, well-marked roads, clear footpaths, organized traffic, construction dust covered, photorealistic."
  • Output: { "repaired_image_url": "gs://..." }

4. Result Fetch

GET /api/result/{upload_id}

  • Output:
    • status: processing | completed | rejected
    • before_url: "..."
    • after_url: "..."
    • caption: "This maintenance visualization shows the impact of waste removal and footpath repairs."

๐Ÿ“ฃ Phase 2: Social & Customization (Roadmap)

We are expanding Imagine India to be fully interactive on social platforms, allowing users to guide the transformation.

1. User Inputs

To make the vision more relevant, we will allow two optional inputs:

  • ๐Ÿ“ Location (City/Area): E.g., "Bangalore, Indiranagar" or "Mumbai, Bandra". Why? To help the AI pick native plants (e.g., Bougainvillea in Bangalore vs. Palms in Goa) and local architectural styles.
  • ๐Ÿ’ญ Custom One-Liner: A specific instruction from the user. E.g., "Clear the footpath," "Add a bike lane," "Fix the potholes," or "Make it walkable."

2. ๐Ÿฆ X (Twitter) Experience

  • Trigger: User replies to a photo or posts a photo tagging @ImagineIndiaAI.

2. ๐Ÿฆ X (Twitter) Experience

  • Trigger: User replies to a photo or posts a photo tagging @ImagineIndiaAI.

2. ๐Ÿฆ X (Twitter) Bot

  • Philosophy: "Meet them in the feed."
  • Trigger: User replies to a photo or tweets an image tagging @ImagineIndAI.
  • Architecture:
    • Uses a Firebase HTTPS Function as a Webhook listener for Twitter's Account Activity API.
    • No new servers needed. It runs on the same infrastructure as the web app.
  • Experience:
    1. User: "@ImagineIndAI fix this mess in Indiranagar traffic."
    2. Bot: Replies in ~30s with the "After" visualization.
    3. Viral Hook: The reply includes a "Share with 1-Click" link to tag local authorities.

3. ๐Ÿค– Reddit Bot

  • Philosophy: "Deep Community Engagement."
  • Trigger: Mentions u/ImagineIndiaBot in comments.
  • Architecture:
    • Uses a Firebase Scheduled Function (running every 2 mins) to scan for new mentions using snoowrap.
    • Cost-Effective: Only runs when needed.
  • Experience:
    1. Bot detects mention.
    2. Generates image + "Civic Report" (text summary of fixes).
    3. Posts a comment with the Imgur/Firebase link.

4. ๐ŸŒ Location Intelligence

  • Feature: The bots will parse the text for location keywords (e.g., "Mumbai", "Bangalore").
  • Impact: The AI will adapt its style (e.g., yellow-black taxis for Mumbai, green rickshaws for Delhi) based on this context.

4. Interactive Gallery

The web gallery will be updated to filter by City/Location, creating a "Civic Health Map" of user-submitted improvements.


๐Ÿ’ป Getting Started

Prerequisites

  • Node.js (v18 or higher)
  • npm or yarn
  • Firebase CLI: npm install -g firebase-tools
  • Google Cloud Project with Vertex AI / Gemini API enabled.

Installation

  1. Clone the repository:

    git clone https://github.com/mehulbhardwaj/civicMirror.git
    cd civicMirror
  2. Install dependencies:

    npm install
  3. Environment Setup: Create a .env.local file in the root directory:

    NEXT_PUBLIC_FIREBASE_API_KEY=your_api_key
    NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN=your_project_id.firebaseapp.com
    NEXT_PUBLIC_FIREBASE_PROJECT_ID=your_project_id
    FIREBASE_CLIENT_EMAIL=your_service_account_email
    FIREBASE_PRIVATE_KEY=your_service_account_private_key
    GOOGLE_GEN_AI_KEY=your_gemini_api_key
    TWITTER_API_KEY=your_twitter_key
    TWITTER_API_SECRET=your_twitter_secret
    REDDIT_CLIENT_ID=your_reddit_client_id
    REDDIT_CLIENT_SECRET=your_reddit_client_secret
  4. Run Locally:

    npm run dev

    Open http://localhost:3000 with your browser.


๐Ÿค Contributing

We welcome contributions that help us make cities cleaner and greener!

  1. Fork the project.
  2. Create your feature branch (git checkout -b feature/AmazingFeature).
  3. Commit your changes (git commit -m 'Add some AmazingFeature').
  4. Push to the branch (git push origin feature/AmazingFeature).
  5. Open a Pull Request.

Important: Please read our CODE_OF_CONDUCT.md to understand the "System Behavior Contract"โ€”we strictly enforce realism and neutrality in all AI prompts.


๐Ÿ“„ License

MIT

About

No description, website, or topics provided.

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors