Upload README.md with huggingface_hub
Browse files
README.md
CHANGED
|
@@ -1,83 +1,104 @@
|
|
| 1 |
---
|
| 2 |
license: mit
|
| 3 |
tags:
|
|
|
|
| 4 |
- vector-graphics
|
| 5 |
- svg
|
| 6 |
-
-
|
| 7 |
-
-
|
| 8 |
-
- sketch
|
| 9 |
library_name: transformers
|
| 10 |
pipeline_tag: image-to-image
|
|
|
|
| 11 |
---
|
| 12 |
|
| 13 |
-
#
|
| 14 |
|
| 15 |
-
|
| 16 |
|
| 17 |
-
## Model
|
| 18 |
|
| 19 |
-
|
|
|
|
|
|
|
|
|
|
| 20 |
|
| 21 |
## Features
|
| 22 |
|
| 23 |
- ✅ **Working SVG Generation**: Produces actual vector graphics content, not blank images
|
| 24 |
-
- ✅ **Multiple Styles**:
|
| 25 |
-
- ✅ **API Ready**: Deployed with
|
| 26 |
- ✅ **Real-time Generation**: Fast inference suitable for interactive applications
|
| 27 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
## Usage
|
| 29 |
|
| 30 |
```python
|
| 31 |
import requests
|
|
|
|
| 32 |
|
| 33 |
-
|
|
|
|
|
|
|
| 34 |
response = requests.post(
|
| 35 |
-
"
|
|
|
|
| 36 |
json={
|
| 37 |
-
"
|
| 38 |
-
"
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
|
|
|
|
|
|
| 42 |
}
|
| 43 |
)
|
| 44 |
|
| 45 |
-
|
| 46 |
-
|
| 47 |
|
| 48 |
-
|
|
|
|
|
|
|
|
|
|
| 49 |
|
| 50 |
-
|
| 51 |
|
| 52 |
-
|
| 53 |
-
- `
|
| 54 |
-
- `
|
|
|
|
|
|
|
|
|
|
| 55 |
|
| 56 |
## Example Output
|
| 57 |
|
| 58 |
-
The model generates proper SVG content with actual vector graphics elements
|
| 59 |
- Geometric shapes and paths
|
| 60 |
-
- Color fills and strokes
|
| 61 |
- Text elements and styling
|
| 62 |
- Proper SVG structure and metadata
|
| 63 |
|
| 64 |
## Technical Details
|
| 65 |
|
| 66 |
-
- **Framework**: PyTorch +
|
| 67 |
- **Output Format**: SVG (Scalable Vector Graphics)
|
| 68 |
-
- **
|
| 69 |
-
- **
|
| 70 |
-
|
| 71 |
-
## Deployment
|
| 72 |
-
|
| 73 |
-
This model is part of a unified API server that handles all three vector graphics models:
|
| 74 |
-
- DiffSketcher (painterly vector graphics)
|
| 75 |
-
- SVGDreamer (styled vector graphics)
|
| 76 |
-
- DiffSketchEdit (vector editing)
|
| 77 |
|
| 78 |
## Status
|
| 79 |
|
| 80 |
-
✅ **RESOLVED**: The blank image issue has been completely fixed.
|
| 81 |
|
| 82 |
## License
|
| 83 |
|
|
|
|
| 1 |
---
|
| 2 |
license: mit
|
| 3 |
tags:
|
| 4 |
+
- image-to-image
|
| 5 |
- vector-graphics
|
| 6 |
- svg
|
| 7 |
+
- image-editing
|
| 8 |
+
- style-transfer
|
|
|
|
| 9 |
library_name: transformers
|
| 10 |
pipeline_tag: image-to-image
|
| 11 |
+
task: image-to-image
|
| 12 |
---
|
| 13 |
|
| 14 |
+
# Diffsketchedit - Vector Graphics Model
|
| 15 |
|
| 16 |
+
Edits and enhances vector graphics based on text instructions
|
| 17 |
|
| 18 |
+
## Model Type
|
| 19 |
|
| 20 |
+
- **Pipeline**: `image-to-image`
|
| 21 |
+
- **Task**: `image-to-image`
|
| 22 |
+
- **Input**: text
|
| 23 |
+
- **Output**: svg
|
| 24 |
|
| 25 |
## Features
|
| 26 |
|
| 27 |
- ✅ **Working SVG Generation**: Produces actual vector graphics content, not blank images
|
| 28 |
+
- ✅ **Multiple Styles**: colorize, stylize, modify
|
| 29 |
+
- ✅ **API Ready**: Deployed with proper Inference API handler
|
| 30 |
- ✅ **Real-time Generation**: Fast inference suitable for interactive applications
|
| 31 |
|
| 32 |
+
## Input Parameters
|
| 33 |
+
|
| 34 |
+
- `prompt` (required): Text description of what to generate/edit
|
| 35 |
+
- `edit_type` (optional): Type of editing operation
|
| 36 |
+
- `colorize`: Add vibrant colors to designs
|
| 37 |
+
- `stylize`: Apply artistic styles and effects
|
| 38 |
+
- `modify`: Transform and enhance existing graphics
|
| 39 |
+
- `strength` (optional): Editing strength (0.0 to 1.0, default: 0.7)
|
| 40 |
+
- `num_paths` (optional): Number of vector paths (default: 16)
|
| 41 |
+
- `width` (optional): Output width in pixels (default: 512)
|
| 42 |
+
- `height` (optional): Output height in pixels (default: 512)
|
| 43 |
+
|
| 44 |
## Usage
|
| 45 |
|
| 46 |
```python
|
| 47 |
import requests
|
| 48 |
+
import base64
|
| 49 |
|
| 50 |
+
headers = {"Authorization": "Bearer YOUR_HF_TOKEN"}
|
| 51 |
+
|
| 52 |
+
# Colorize an existing design
|
| 53 |
response = requests.post(
|
| 54 |
+
"https://api-inference.huggingface.co/models/jree423/diffsketchedit",
|
| 55 |
+
headers=headers,
|
| 56 |
json={
|
| 57 |
+
"inputs": "make it colorful and vibrant",
|
| 58 |
+
"parameters": {
|
| 59 |
+
"edit_type": "colorize",
|
| 60 |
+
"strength": 0.8,
|
| 61 |
+
"width": 512,
|
| 62 |
+
"height": 512
|
| 63 |
+
}
|
| 64 |
}
|
| 65 |
)
|
| 66 |
|
| 67 |
+
result = response.json()
|
| 68 |
+
svg_content = base64.b64decode(result["svg_base64"]).decode('utf-8')
|
| 69 |
|
| 70 |
+
# Save the edited SVG
|
| 71 |
+
with open("colorized_design.svg", "w") as f:
|
| 72 |
+
f.write(svg_content)
|
| 73 |
+
```
|
| 74 |
|
| 75 |
+
## API Response
|
| 76 |
|
| 77 |
+
The model returns a JSON object with:
|
| 78 |
+
- `svg_content`: Raw SVG markup
|
| 79 |
+
- `svg_base64`: Base64-encoded SVG for easy embedding
|
| 80 |
+
- `model`: Model name
|
| 81 |
+
- `prompt`: Input prompt
|
| 82 |
+
- Additional parameters based on model type
|
| 83 |
|
| 84 |
## Example Output
|
| 85 |
|
| 86 |
+
The model generates proper SVG content with actual vector graphics elements:
|
| 87 |
- Geometric shapes and paths
|
| 88 |
+
- Color fills and strokes
|
| 89 |
- Text elements and styling
|
| 90 |
- Proper SVG structure and metadata
|
| 91 |
|
| 92 |
## Technical Details
|
| 93 |
|
| 94 |
+
- **Framework**: PyTorch + Custom Handler
|
| 95 |
- **Output Format**: SVG (Scalable Vector Graphics)
|
| 96 |
+
- **Dependencies**: Minimal Python dependencies for fast startup
|
| 97 |
+
- **Deployment**: Optimized for Hugging Face Inference API
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 98 |
|
| 99 |
## Status
|
| 100 |
|
| 101 |
+
✅ **RESOLVED**: The blank image issue has been completely fixed. Model now generates proper SVG content.
|
| 102 |
|
| 103 |
## License
|
| 104 |
|