Skip to content

Building an Instagram clone, where instead of users uploading pictures themselves, they can generate images with text prompts. Instead of using existing image generation APIs, we will have to host an image generation model ourself on serverless GPUs and ensure low latency for a smooth user experience.

Notifications You must be signed in to change notification settings

sheicky/pentagram

Repository files navigation

Pentagram: Instagram, but with AI Images

A modern web application that generates high-quality images using Stable Diffusion XL Turbo, powered by Modal's A10G GPU infrastructure.

image

Youtube demo : https://youtu.be/gO-RcNphq44

🚀 Features

  • Fast Image Generation: Generate high-quality images in under 2 seconds
  • Real-time Updates: Live loading states and image preview
  • Efficient Storage: Automated image storage using Vercel Blob Storage

⚡ Tech Stack

Frontend

  • Next.js 14 (React)
  • TypeScript
  • Tailwind CSS
  • React Hooks

Backend

  • Next.js API Routes
  • Modal Cloud GPU (NVIDIA A10G)
  • Stable Diffusion XL Turbo
  • Vercel Blob Storage

🛠 Installation

  1. Clone the repository:
git clone https://github.com/yourusername/project-name.git
  1. Install dependencies:
npm install
  1. Set up environment variables: Create a .env file in the root directory with the following variables:
PENTAGRAM_URL=your_pentagram_url
API_TOKEN_PENTAGRAM=your_api_token
BLOB_READ_WRITE_TOKEN=your_blob_token ( from vercel)
  1. Run the development server:
npm run dev

🌐 Usage

  1. Open the application in your browser
  2. Enter a description of the image you want to generate
  3. Click "Generate" and wait for your image
  4. The generated image will be displayed and automatically saved

⚙️ Architecture

graph LR
    A[User Input] --> B[Next.js API]
    B --> C[Modal A10G GPU]
    C --> D[SDXL-Turbo]
    D --> E[Vercel Blob Storage]
    E --> F[Client Display]
Loading

🔑 Environment Variables

  • PENTAGRAM_URL: URL for the image generation service (from modal)
  • API_TOKEN_PENTAGRAM: Authentication token for the API
  • BLOB_READ_WRITE_TOKEN: Token for Vercel Blob Storage access

🚀 Deployment

This project is optimized for deployment on Vercel:

  1. Push your code to GitHub
  2. Connect your repository to Vercel
  3. Configure environment variables in Vercel dashboard
  4. Deploy!

📈 Performance

  • Image Generation: ~2 seconds
  • API Response Time: ~200ms
  • Blob Storage Upload: ~500ms

👏

Made with ❤️ by Sheick

About

Building an Instagram clone, where instead of users uploading pictures themselves, they can generate images with text prompts. Instead of using existing image generation APIs, we will have to host an image generation model ourself on serverless GPUs and ensure low latency for a smooth user experience.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors