jree423 commited on
Commit
d8e9170
·
verified ·
1 Parent(s): b4d1ac3

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +57 -36
README.md CHANGED
@@ -1,83 +1,104 @@
1
  ---
2
  license: mit
3
  tags:
 
4
  - vector-graphics
5
  - svg
6
- - diffusion
7
- - art-generation
8
- - sketch
9
  library_name: transformers
10
  pipeline_tag: image-to-image
 
11
  ---
12
 
13
- # DiffSketchEdit - Vector Graphics Editing
14
 
15
- DiffSketchEdit provides vector graphics editing capabilities including colorization, stylization, and modification of existing SVG content. It can transform and enhance vector graphics with various artistic effects.
16
 
17
- ## Model Description
18
 
19
- This model is part of a unified vector graphics generation system that creates SVG content instead of raster images. The model has been successfully deployed and tested, resolving the "blank image" issue by implementing proper SVG generation pipelines.
 
 
 
20
 
21
  ## Features
22
 
23
  - ✅ **Working SVG Generation**: Produces actual vector graphics content, not blank images
24
- - ✅ **Multiple Styles**: Supports different artistic styles and approaches
25
- - ✅ **API Ready**: Deployed with Flask API for easy integration
26
  - ✅ **Real-time Generation**: Fast inference suitable for interactive applications
27
 
 
 
 
 
 
 
 
 
 
 
 
 
28
  ## Usage
29
 
30
  ```python
31
  import requests
 
32
 
33
- # Edit/colorize a vector graphic
 
 
34
  response = requests.post(
35
- "http://localhost:5000/diffsketchedit/edit_base64",
 
36
  json={
37
- "prompt": "make it colorful",
38
- "edit_type": "colorize",
39
- "strength": 0.7,
40
- "width": 512,
41
- "height": 512
 
 
42
  }
43
  )
44
 
45
- svg_data = response.json()["svg_base64"]
46
- ```
47
 
48
- ## API Endpoints
 
 
 
49
 
50
- The model is deployed with the following endpoints:
51
 
52
- - `POST /generate_base64` - Generate SVG and return as base64
53
- - `POST /generate` - Generate SVG and return as file download
54
- - `GET /health` - Health check endpoint
 
 
 
55
 
56
  ## Example Output
57
 
58
- The model generates proper SVG content with actual vector graphics elements, including:
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 + Flask API
67
  - **Output Format**: SVG (Scalable Vector Graphics)
68
- - **Input**: Text prompts
69
- - **Dependencies**: torch, diffusers, transformers, svgwrite, flask
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. All models now generate proper SVG content.
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