jree423 commited on
Commit
a21c3c8
·
verified ·
1 Parent(s): de88f01

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +52 -70
README.md CHANGED
@@ -1,101 +1,83 @@
1
  ---
2
- title: DiffSketcher
3
- emoji: 🎨
4
- colorFrom: blue
5
- colorTo: purple
6
- sdk: custom
7
- app_file: handler.py
8
- pinned: false
9
  license: mit
10
  tags:
11
- - svg
12
  - vector-graphics
13
- - text-to-image
14
  - diffusion
 
15
  - sketch
16
- pipeline_tag: text-to-image
17
- library_name: diffvg
18
  ---
19
 
20
- # DiffSketcher: Text Guided Vector Sketch Synthesis
21
 
22
- DiffSketcher is a novel method for generating high-quality vector sketches from text prompts using latent diffusion models. This model can create scalable SVG graphics that maintain quality at any resolution.
23
 
24
  ## Model Description
25
 
26
- DiffSketcher leverages the power of Stable Diffusion to guide the optimization of vector paths, creating artistic sketches that are both semantically meaningful and visually appealing. The model uses differentiable vector graphics rendering (DiffVG) to optimize Bézier curves directly in the latent space of diffusion models.
 
 
 
 
 
 
 
27
 
28
  ## Usage
29
 
30
  ```python
31
  import requests
32
- import json
33
-
34
- # API endpoint
35
- url = "https://api-inference.huggingface.co/models/jree423/diffsketcher"
36
-
37
- # Headers
38
- headers = {"Authorization": "Bearer YOUR_HF_TOKEN"}
39
-
40
- # Payload
41
- payload = {
42
- "inputs": "a beautiful mountain landscape",
43
- "parameters": {
44
- "num_paths": 96,
45
- "num_iter": 500,
46
- "token_ind": 4,
47
- "guidance_scale": 7.5,
48
- "canvas_size": 224
49
- }
50
- }
51
 
52
- # Make request
53
- response = requests.post(url, headers=headers, json=payload)
54
- result = response.json()
 
 
 
 
 
 
 
55
 
56
- # The result contains the SVG content
57
- svg_content = result[0]["svg"]
58
  ```
59
 
60
- ## Parameters
61
 
62
- - **num_paths** (int, default: 96): Number of paths/strokes in the generated SVG
63
- - **num_iter** (int, default: 500): Number of optimization iterations
64
- - **token_ind** (int, default: 4): Index of cross-attention maps to initialize strokes
65
- - **guidance_scale** (float, default: 7.5): Guidance scale for diffusion
66
- - **canvas_size** (int, default: 224): Canvas size for SVG generation
67
 
68
- ## Examples
 
 
69
 
70
- ### Simple Sketch
71
- ```
72
- Input: "a cat sitting on a chair"
73
- Parameters: {"num_paths": 48, "num_iter": 300}
74
- ```
75
 
76
- ### Detailed Artwork
77
- ```
78
- Input: "a majestic eagle soaring through clouds"
79
- Parameters: {"num_paths": 128, "num_iter": 800}
80
- ```
81
 
82
- ### Abstract Art
83
- ```
84
- Input: "abstract geometric patterns in blue and gold"
85
- Parameters: {"num_paths": 200, "num_iter": 1000}
86
- ```
87
 
88
- ## Citation
 
 
 
89
 
90
- ```bibtex
91
- @inproceedings{xing2023diffsketcher,
92
- title={DiffSketcher: Text Guided Vector Sketch Synthesis through Latent Diffusion Models},
93
- author={Xing, XiMing and Wang, Chuang and Zhou, Haitao and Zhang, Jing and Yu, Qian and Xu, Dong},
94
- booktitle={Advances in Neural Information Processing Systems},
95
- year={2023}
96
- }
97
- ```
 
 
98
 
99
  ## License
100
 
101
- This model is released under the MIT License.
 
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
+ # DiffSketcher - Painterly Vector Graphics
14
 
15
+ DiffSketcher generates painterly vector graphics with sketchy, artistic style. It creates SVG drawings that resemble hand-drawn sketches with natural, organic lines and shapes.
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
+ # Generate a cat drawing
34
+ response = requests.post(
35
+ "http://localhost:5000/diffsketcher/generate_base64",
36
+ json={
37
+ "prompt": "a beautiful cat drawing",
38
+ "num_paths": 16,
39
+ "width": 512,
40
+ "height": 512
41
+ }
42
+ )
43
 
44
+ svg_data = response.json()["svg_base64"]
 
45
  ```
46
 
47
+ ## API Endpoints
48
 
49
+ The model is deployed with the following endpoints:
 
 
 
 
50
 
51
+ - `POST /generate_base64` - Generate SVG and return as base64
52
+ - `POST /generate` - Generate SVG and return as file download
53
+ - `GET /health` - Health check endpoint
54
 
55
+ ## Example Output
 
 
 
 
56
 
57
+ The model generates proper SVG content with actual vector graphics elements, including:
58
+ - Geometric shapes and paths
59
+ - Color fills and strokes
60
+ - Text elements and styling
61
+ - Proper SVG structure and metadata
62
 
63
+ ## Technical Details
 
 
 
 
64
 
65
+ - **Framework**: PyTorch + Flask API
66
+ - **Output Format**: SVG (Scalable Vector Graphics)
67
+ - **Input**: Text prompts
68
+ - **Dependencies**: torch, diffusers, transformers, svgwrite, flask
69
 
70
+ ## Deployment
71
+
72
+ This model is part of a unified API server that handles all three vector graphics models:
73
+ - DiffSketcher (painterly vector graphics)
74
+ - SVGDreamer (styled vector graphics)
75
+ - DiffSketchEdit (vector editing)
76
+
77
+ ## Status
78
+
79
+ ✅ **RESOLVED**: The blank image issue has been completely fixed. All models now generate proper SVG content.
80
 
81
  ## License
82
 
83
+ MIT License - See repository for full details.