Update README.md with proper YAML metadata
Browse files
README.md
CHANGED
|
@@ -1,10 +1,11 @@
|
|
| 1 |
---
|
| 2 |
-
|
|
|
|
| 3 |
tags:
|
| 4 |
- text-to-image
|
| 5 |
- svg
|
| 6 |
- vector-graphics
|
| 7 |
-
|
| 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
|
| 25 |
|
| 26 |
def query(prompt):
|
| 27 |
response = requests.post(API_URL, headers=headers, json={"inputs": prompt})
|
| 28 |
-
return response.content
|
| 29 |
|
| 30 |
# Generate an image
|
| 31 |
with open("output.png", "wb") as f:
|
| 32 |
f.write(query("a beautiful mountain landscape"))
|
| 33 |
```
|
| 34 |
|
| 35 |
-
|
| 36 |
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 41 |
|
| 42 |
-
##
|
| 43 |
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
|
|
|
| 48 |
|
| 49 |
-
##
|
| 50 |
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
```
|