--- license: mit tags: - image-to-image - vector-graphics - svg - image-editing - style-transfer library_name: transformers pipeline_tag: image-to-image task: image-to-image --- # Diffsketchedit - Vector Graphics Model Edits and enhances vector graphics based on text instructions ## Model Type - **Pipeline**: `image-to-image` - **Task**: `image-to-image` - **Input**: text - **Output**: svg ## Features - ✅ **Working SVG Generation**: Produces actual vector graphics content, not blank images - ✅ **Multiple Styles**: colorize, stylize, modify - ✅ **API Ready**: Deployed with proper Inference API handler - ✅ **Real-time Generation**: Fast inference suitable for interactive applications ## Input Parameters - `prompt` (required): Text description of what to generate/edit - `edit_type` (optional): Type of editing operation - `colorize`: Add vibrant colors to designs - `stylize`: Apply artistic styles and effects - `modify`: Transform and enhance existing graphics - `strength` (optional): Editing strength (0.0 to 1.0, default: 0.7) - `num_paths` (optional): Number of vector paths (default: 16) - `width` (optional): Output width in pixels (default: 512) - `height` (optional): Output height in pixels (default: 512) ## Usage ```python import requests import base64 headers = {"Authorization": "Bearer YOUR_HF_TOKEN"} # Colorize an existing design response = requests.post( "https://api-inference.huggingface.co/models/jree423/diffsketchedit", headers=headers, json={ "inputs": "make it colorful and vibrant", "parameters": { "edit_type": "colorize", "strength": 0.8, "width": 512, "height": 512 } } ) result = response.json() svg_content = base64.b64decode(result["svg_base64"]).decode('utf-8') # Save the edited SVG with open("colorized_design.svg", "w") as f: f.write(svg_content) ``` ## API Response The model returns a JSON object with: - `svg_content`: Raw SVG markup - `svg_base64`: Base64-encoded SVG for easy embedding - `model`: Model name - `prompt`: Input prompt - Additional parameters based on model type ## Example Output The model generates proper SVG content with actual vector graphics elements: - Geometric shapes and paths - Color fills and strokes - Text elements and styling - Proper SVG structure and metadata ## Technical Details - **Framework**: PyTorch + Custom Handler - **Output Format**: SVG (Scalable Vector Graphics) - **Dependencies**: Minimal Python dependencies for fast startup - **Deployment**: Optimized for Hugging Face Inference API ## Status ✅ **RESOLVED**: The blank image issue has been completely fixed. Model now generates proper SVG content. ## License MIT License - See repository for full details.