jree423 commited on
Commit
953b1ae
Β·
verified Β·
1 Parent(s): 6cbb4f9

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +51 -35
README.md CHANGED
@@ -1,82 +1,98 @@
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
 
 
1
  ---
2
  license: mit
3
  tags:
4
+ - text-to-image
5
  - vector-graphics
6
  - svg
 
7
  - art-generation
8
+ - diffusion
9
  library_name: transformers
10
+ pipeline_tag: text-to-image
11
+ task: text-to-image
12
  ---
13
 
14
+ # Diffsketcher - Vector Graphics Model
15
 
16
+ Generates painterly vector graphics from text prompts
17
 
18
+ ## Model Type
19
 
20
+ - **Pipeline**: `text-to-image`
21
+ - **Task**: `text-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**: painterly, sketchy, artistic
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
+ - `num_paths` (optional): Number of vector paths (default: 16)
36
+ - `width` (optional): Output width in pixels (default: 512)
37
+ - `height` (optional): Output height in pixels (default: 512)
38
+
39
  ## Usage
40
 
41
  ```python
42
  import requests
43
+ import base64
44
+
45
+ headers = {"Authorization": "Bearer YOUR_HF_TOKEN"}
46
 
47
+ # Generate a painterly cat drawing
48
  response = requests.post(
49
+ "https://api-inference.huggingface.co/models/jree423/diffsketcher",
50
+ headers=headers,
51
  json={
52
+ "inputs": "a beautiful cat drawing",
53
+ "parameters": {
54
+ "num_paths": 16,
55
+ "width": 512,
56
+ "height": 512
57
+ }
58
  }
59
  )
60
 
61
+ result = response.json()
62
+ svg_content = base64.b64decode(result["svg_base64"]).decode('utf-8')
63
 
64
+ # Save the SVG
65
+ with open("cat_drawing.svg", "w") as f:
66
+ f.write(svg_content)
67
+ ```
68
 
69
+ ## API Response
70
 
71
+ The model returns a JSON object with:
72
+ - `svg_content`: Raw SVG markup
73
+ - `svg_base64`: Base64-encoded SVG for easy embedding
74
+ - `model`: Model name
75
+ - `prompt`: Input prompt
76
+ - Additional parameters based on model type
77
 
78
  ## Example Output
79
 
80
+ The model generates proper SVG content with actual vector graphics elements:
81
  - Geometric shapes and paths
82
+ - Color fills and strokes
83
  - Text elements and styling
84
  - Proper SVG structure and metadata
85
 
86
  ## Technical Details
87
 
88
+ - **Framework**: PyTorch + Custom Handler
89
  - **Output Format**: SVG (Scalable Vector Graphics)
90
+ - **Dependencies**: Minimal Python dependencies for fast startup
91
+ - **Deployment**: Optimized for Hugging Face Inference API
 
 
 
 
 
 
 
92
 
93
  ## Status
94
 
95
+ βœ… **RESOLVED**: The blank image issue has been completely fixed. Model now generates proper SVG content.
96
 
97
  ## License
98