jree423 commited on
Commit
9e74786
·
verified ·
1 Parent(s): 69b2d5c

Update README.md with proper YAML metadata

Browse files
Files changed (1) hide show
  1. README.md +36 -18
README.md CHANGED
@@ -1,10 +1,11 @@
1
  ---
2
- pipeline_tag: text-to-image
 
3
  tags:
4
  - text-to-image
5
  - svg
6
  - vector-graphics
7
- license: mit
8
  ---
9
 
10
  # DiffSketcher - Vector Graphics Generation
@@ -21,33 +22,50 @@ DiffSketcher is a state-of-the-art vector graphics generation model that creates
21
  import requests
22
 
23
  API_URL = "https://api-inference.huggingface.co/models/jree423/diffsketcher"
24
- headers = {"Authorization": "Bearer YOUR_API_TOKEN"}
25
 
26
  def query(prompt):
27
  response = requests.post(API_URL, headers=headers, json={"inputs": prompt})
28
- return response.content # Returns the image directly
29
 
30
  # Generate an image
31
  with open("output.png", "wb") as f:
32
  f.write(query("a beautiful mountain landscape"))
33
  ```
34
 
35
- ## Examples
36
 
37
- - "a beautiful mountain landscape"
38
- - "a red sports car"
39
- - "a portrait of a woman"
40
- - "a cat playing with a ball"
 
 
 
 
 
 
 
 
 
 
 
41
 
42
- ## How It Works
43
 
44
- 1. **Text Encoding**: The text prompt is encoded using CLIP.
45
- 2. **Diffusion Process**: A diffusion model generates a latent representation.
46
- 3. **SVG Generation**: The latent representation is used to generate an SVG.
47
- 4. **PNG Conversion**: The SVG is converted to PNG for display.
 
48
 
49
- ## Performance Considerations
50
 
51
- - The original implementation requires significant computational resources
52
- - Generation can take several minutes depending on the complexity
53
- - GPU acceleration is recommended for optimal performance
 
 
 
 
 
 
1
  ---
2
+ language: en
3
+ license: mit
4
  tags:
5
  - text-to-image
6
  - svg
7
  - vector-graphics
8
+ pipeline_tag: text-to-image
9
  ---
10
 
11
  # DiffSketcher - Vector Graphics Generation
 
22
  import requests
23
 
24
  API_URL = "https://api-inference.huggingface.co/models/jree423/diffsketcher"
25
+ headers = {"Authorization": "Bearer YOUR_TOKEN"}
26
 
27
  def query(prompt):
28
  response = requests.post(API_URL, headers=headers, json={"inputs": prompt})
29
+ return response.content
30
 
31
  # Generate an image
32
  with open("output.png", "wb") as f:
33
  f.write(query("a beautiful mountain landscape"))
34
  ```
35
 
36
+ You can also specify additional parameters:
37
 
38
+ ```python
39
+ response = requests.post(
40
+ API_URL,
41
+ headers=headers,
42
+ json={
43
+ "inputs": {
44
+ "text": "a beautiful mountain landscape",
45
+ "width": 512,
46
+ "height": 512,
47
+ "num_paths": 512,
48
+ "seed": 42
49
+ }
50
+ }
51
+ )
52
+ ```
53
 
54
+ ## Parameters
55
 
56
+ - `text` (str): The text prompt to generate an image from.
57
+ - `width` (int, optional): The width of the generated image. Default: 512.
58
+ - `height` (int, optional): The height of the generated image. Default: 512.
59
+ - `num_paths` (int, optional): The number of paths to use in the SVG. Default: 512.
60
+ - `seed` (int, optional): The random seed to use for generation. Default: None (random).
61
 
62
+ ## Citation
63
 
64
+ ```bibtex
65
+ @inproceedings{xing2023diffsketcher,
66
+ title={DiffSketcher: Text Guided Vector Sketch Synthesis through Latent Diffusion Models},
67
+ author={Xing, XiMing and Zhan, Chuang and Xu, Yinghao and Dong, Yue and Yu, Yingqing and Li, Chongyang and Liu, Yong Jin},
68
+ booktitle={Advances in Neural Information Processing Systems},
69
+ year={2023}
70
+ }
71
+ ```