--- title: VIBE_LINK Server emoji: 🎨 colorFrom: gray colorTo: green sdk: docker app_port: 7860 pinned: false --- # 🎨 VIBE_LINK Backend AI-powered serverless API that transforms website URLs into stunning "Vibe Poster" images using Google Gemini and Hugging Face Flux.1. ## πŸš€ Features - **Screenshot Capture**: Headless Chrome (pyppeteer) for high-quality website screenshots - **AI Analysis**: Google Gemini 2.5 Flash extracts design vibe and generates artistic prompts - **Image Generation**: Hugging Face Flux.1-dev creates 3D abstract posters - **Cloud Hosting**: ImgBB API for permanent image storage - **Optimized**: Production-ready with minimal resource footprint ## πŸ—οΈ Tech Stack - **Framework**: FastAPI + Uvicorn - **AI Models**: - Google Gemini 2.0 Flash Exp (vision analysis) - FLUX.1-dev (image generation) - **Infrastructure**: Docker (Hugging Face Spaces) - **Language**: Python 3.9 ## πŸ“¦ Installation ### 1. Clone Repository ```bash git clone https://github.com/Lcmind/vibe-link-backend.git cd vibe-link-backend ``` ### 2. Set Environment Variables ```bash cp .env.example .env # Edit .env and add your API keys: # - HF_TOKEN (Hugging Face) # - GEMINI_API_KEY (Google AI Studio) # - IMGBB_KEY (ImgBB) ``` ### 3. Run Locally (Docker) ```bash docker build -t vibe-link-backend . docker run -p 7860:7860 --env-file .env vibe-link-backend ``` ### 4. Run Locally (Python) ```bash python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate pip install -r requirements.txt uvicorn main:app --reload --port 7860 ``` ## 🌐 API Usage ### POST /create Generate a vibe poster from a website URL. **Request:** ```json { "url": "https://example.com" } ``` **Response:** ```json { "status": "success", "poster_url": "https://i.ibb.co/abc123/poster.webp", "vibe": "Minimalist", "summary": "κΉ”λ”ν•œ λ””μžμΈκ³Ό λͺ…ν™•ν•œ νƒ€μ΄ν¬κ·Έλž˜ν”Όκ°€ λ‹λ³΄μ΄λŠ” ν˜„λŒ€μ μΈ μ›Ήμ‚¬μ΄νŠΈ" } ``` ### GET /health Health check endpoint. **Response:** ```json { "status": "healthy", "service": "vibe-link-backend" } ``` ## 🎯 Deployment to Hugging Face Spaces ### 1. Create a New Space 1. Go to [Hugging Face Spaces](https://huggingface.co/spaces) 2. Click **"Create new Space"** 3. Select **Docker** as SDK 4. Name: `vibe-link-backend` ### 2. Push Code to HF Space ```bash # Add Hugging Face as remote git remote add hf https://huggingface.co/spaces/YOUR_USERNAME/vibe-link-backend git push hf main ``` ### 3. Configure Secrets In Space Settings β†’ Repository Secrets, add: - `HF_TOKEN` - `GEMINI_API_KEY` - `IMGBB_KEY` ### 4. Access Your API ``` https://YOUR_USERNAME-vibe-link-backend.hf.space/ ``` ## πŸ”§ Configuration ### Environment Variables | Variable | Description | Required | |----------|-------------|----------| | `HF_TOKEN` | Hugging Face API token | βœ… | | `GEMINI_API_KEY` | Google Gemini API key | βœ… | | `IMGBB_KEY` | ImgBB API key | βœ… | ### Get API Keys - **Hugging Face**: https://huggingface.co/settings/tokens - **Google Gemini**: https://aistudio.google.com/app/apikey - **ImgBB**: https://api.imgbb.com/ ## πŸ“Š Pipeline Architecture ``` β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ POST /create { "url": "https://example.com" } β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ STEP 1: Screenshot Capture β”‚ β”‚ Tool: pyppeteer β”‚ β”‚ Output: screenshot.jpg β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ STEP 2: AI Analysis β”‚ β”‚ Tool: Google Gemini 2.5 Flash β”‚ β”‚ Output: vibe + flux_prompt β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ STEP 3: Image Generation β”‚ β”‚ Tool: HF Flux.1-dev β”‚ β”‚ Output: poster.webp β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ STEP 4: Upload to ImgBB β”‚ β”‚ Tool: ImgBB API β”‚ β”‚ Output: public URL β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ Response: { poster_url } β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ ``` ## πŸ› οΈ Development ### Project Structure ``` vibe-link-backend/ β”œβ”€β”€ main.py # FastAPI application β”œβ”€β”€ requirements.txt # Python dependencies β”œβ”€β”€ Dockerfile # Docker configuration β”œβ”€β”€ .env.example # Environment template β”œβ”€β”€ .gitignore # Git ignore rules └── README.md # Documentation ``` ### Code Quality Features - βœ… Type hints (Pydantic models) - βœ… Error handling & logging - βœ… Resource cleanup (temp files) - βœ… Docker health checks - βœ… Production-ready CORS - βœ… Memory-optimized Chrome args ## πŸ“ License MIT License - feel free to use for your projects! ## 🀝 Contributing Contributions welcome! Please open an issue or PR. ## πŸ“§ Support For issues or questions, open a GitHub issue at: https://github.com/Lcmind/vibe-link-backend/issues --- **Built with ❀️ by S-Grade Developer**