Motto: "Reimagining the Possible"
An art project visualizing a cleaner, greener, and more organized urban future.
Live site: imagineindiaai.com
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.
| Platform | Handle/Link |
|---|---|
| Website | imagineindiaai.com ๐ |
| GitHub | Source Code ๐ป |
| r/ImagineIndia ๐ฎ๐ณ | |
| Twitter/X | @ImagineIndAI |
To prevent scope creep and hallucinations, the system must adhere to these rules:
- Preserve Geometry: Never alter the structure of buildings, road layouts, or time of day.
- Maintenance Only: Only simulate cleaning, repairing, and organizing. Do not "redevelop."
- Realism > Aesthetics: A patched road is better than a gold-plated road.
- Privacy First: Reject private interiors. Blur faces.
- Neutral Tone: Output text must be observational and constructive, never political.
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.
POST /api/upload
- Input:
{ "image_file": [Binary], "location_tag": "string" } - Output:
{ "upload_id": "uuid", "status": "pending_safety_check" }
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
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://..." }
GET /api/result/{upload_id}
- Output:
status:processing | completed | rejectedbefore_url: "..."after_url: "..."caption: "This maintenance visualization shows the impact of waste removal and footpath repairs."
We are expanding Imagine India to be fully interactive on social platforms, allowing users to guide the transformation.
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."
- Trigger: User replies to a photo or posts a photo tagging
@ImagineIndiaAI.
- Trigger: User replies to a photo or posts a photo tagging
@ImagineIndiaAI.
- 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:
- User: "@ImagineIndAI fix this mess in Indiranagar traffic."
- Bot: Replies in ~30s with the "After" visualization.
- Viral Hook: The reply includes a "Share with 1-Click" link to tag local authorities.
- Philosophy: "Deep Community Engagement."
- Trigger: Mentions
u/ImagineIndiaBotin comments. - Architecture:
- Uses a Firebase Scheduled Function (running every 2 mins) to scan for new mentions using
snoowrap. - Cost-Effective: Only runs when needed.
- Uses a Firebase Scheduled Function (running every 2 mins) to scan for new mentions using
- Experience:
- Bot detects mention.
- Generates image + "Civic Report" (text summary of fixes).
- Posts a comment with the Imgur/Firebase link.
- 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.
The web gallery will be updated to filter by City/Location, creating a "Civic Health Map" of user-submitted improvements.
- Node.js (v18 or higher)
- npm or yarn
- Firebase CLI:
npm install -g firebase-tools - Google Cloud Project with Vertex AI / Gemini API enabled.
-
Clone the repository:
git clone https://github.com/mehulbhardwaj/civicMirror.git cd civicMirror -
Install dependencies:
npm install
-
Environment Setup: Create a
.env.localfile 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
-
Run Locally:
npm run dev
Open http://localhost:3000 with your browser.
We welcome contributions that help us make cities cleaner and greener!
- Fork the project.
- Create your feature branch (
git checkout -b feature/AmazingFeature). - Commit your changes (
git commit -m 'Add some AmazingFeature'). - Push to the branch (
git push origin feature/AmazingFeature). - 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.