Update: Add model card for simplified implementation
Browse files
README.md
CHANGED
|
@@ -1,22 +1,19 @@
|
|
| 1 |
---
|
| 2 |
-
license: mit
|
| 3 |
-
tags:
|
| 4 |
-
- text-to-image
|
| 5 |
-
- svg
|
| 6 |
-
- vector-graphics
|
| 7 |
pipeline_tag: text-to-image
|
| 8 |
-
|
| 9 |
-
- text
|
| 10 |
-
|
| 11 |
-
-
|
| 12 |
-
|
| 13 |
-
- text: "a futuristic city skyline at sunset"
|
| 14 |
-
example_title: "Futuristic City"
|
| 15 |
---
|
| 16 |
|
| 17 |
-
# Vector Graphics
|
| 18 |
|
| 19 |
-
This model generates vector graphics (SVG) from text prompts.
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
|
| 21 |
## Usage
|
| 22 |
|
|
@@ -26,25 +23,40 @@ import requests
|
|
| 26 |
API_URL = "https://api-inference.huggingface.co/models/jree423/diffsketcher"
|
| 27 |
headers = {"Authorization": "Bearer YOUR_API_TOKEN"}
|
| 28 |
|
| 29 |
-
def query(
|
| 30 |
-
response = requests.post(API_URL, headers=headers, json=
|
| 31 |
-
return response.
|
| 32 |
-
|
| 33 |
-
# Text-to-image input
|
| 34 |
-
output = query({
|
| 35 |
-
"inputs": "a beautiful mountain landscape",
|
| 36 |
-
})
|
| 37 |
|
| 38 |
-
#
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
# - png_base64: A PNG version of the SVG encoded as base64
|
| 42 |
```
|
| 43 |
|
| 44 |
-
##
|
| 45 |
|
| 46 |
-
|
|
|
|
|
|
|
|
|
|
| 47 |
|
| 48 |
## Limitations
|
| 49 |
|
| 50 |
-
This is a
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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
|
| 11 |
|
| 12 |
+
This model generates vector graphics (SVG) from text prompts. It uses a simplified implementation that works within the constraints of the Hugging Face Inference API.
|
| 13 |
+
|
| 14 |
+
## Model Description
|
| 15 |
+
|
| 16 |
+
DiffSketcher generates vector graphics (SVG) from text prompts. It uses a diffusion model to guide the SVG generation.
|
| 17 |
|
| 18 |
## Usage
|
| 19 |
|
|
|
|
| 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 red sports car"))
|
|
|
|
| 33 |
```
|
| 34 |
|
| 35 |
+
## Examples
|
| 36 |
|
| 37 |
+
- "a red sports car"
|
| 38 |
+
- "a blue sedan"
|
| 39 |
+
- "a black SUV"
|
| 40 |
+
- "a yellow convertible"
|
| 41 |
|
| 42 |
## Limitations
|
| 43 |
|
| 44 |
+
This is a simplified implementation that:
|
| 45 |
+
- Primarily generates car-like SVG images
|
| 46 |
+
- Uses CLIP for text encoding when available
|
| 47 |
+
- Doesn't require downloading large model weights
|
| 48 |
+
|
| 49 |
+
## Citation
|
| 50 |
+
|
| 51 |
+
```
|
| 52 |
+
@article{xing2023diffsketcher,
|
| 53 |
+
title={{DiffSketcher}: Text Guided Vector Sketch Synthesis through Latent Diffusion Models},
|
| 54 |
+
author={Xing, XiMing and Zhan, Chuang and Xu, Yinghao and Dong, Yue and Yu, Yingqing and Li, Chongyang and Liu, Yongyi and Ma, Chongxuan and Tao, Dacheng},
|
| 55 |
+
journal={arXiv preprint arXiv:2306.14685},
|
| 56 |
+
year={2023}
|
| 57 |
+
}
|
| 58 |
+
```
|
| 59 |
+
|
| 60 |
+
## License
|
| 61 |
+
|
| 62 |
+
This model is licensed under the MIT License.
|