Spaces:
Sleeping
Sleeping
metadata
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
git clone https://github.com/Lcmind/vibe-link-backend.git
cd vibe-link-backend
2. Set Environment Variables
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)
docker build -t vibe-link-backend .
docker run -p 7860:7860 --env-file .env vibe-link-backend
4. Run Locally (Python)
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:
{
"url": "https://example.com"
}
Response:
{
"status": "success",
"poster_url": "https://i.ibb.co/abc123/poster.webp",
"vibe": "Minimalist",
"summary": "κΉλν λμμΈκ³Ό λͺ
νν νμ΄ν¬κ·ΈλνΌκ° λ보μ΄λ νλμ μΈ μΉμ¬μ΄νΈ"
}
GET /health
Health check endpoint.
Response:
{
"status": "healthy",
"service": "vibe-link-backend"
}
π― Deployment to Hugging Face Spaces
1. Create a New Space
- Go to Hugging Face Spaces
- Click "Create new Space"
- Select Docker as SDK
- Name:
vibe-link-backend
2. Push Code to HF Space
# 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_TOKENGEMINI_API_KEYIMGBB_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