diffsketcher / README.md
jree423's picture
Upload folder using huggingface_hub
a3ca91d verified
|
raw
history blame
1.79 kB
metadata
language:
  - en
license: mit
library_name: diffvg
tags:
  - vector-graphics
  - svg
  - text-to-image
  - diffusion
  - stable-diffusion
pipeline_tag: text-to-image
inference: true

DiffSketcher

Text-guided vector graphics synthesis

Model Description

DiffSketcher is a vector graphics model that converts text descriptions into scalable vector graphics (SVG). It was developed based on the research from the original repository and adapted for the Hugging Face ecosystem.

How to Use

You can use this model through the Hugging Face Inference API:

import requests
import base64
from PIL import Image
import io

API_URL = "https://api-inference.huggingface.co/models/jree423/diffsketcher"
headers = {"Authorization": "Bearer YOUR_API_TOKEN"}

def query(payload):
    response = requests.post(API_URL, headers=headers, json=payload)
    return response.json()

# Example
payload = {"prompt": "a house with a chimney"}
output = query(payload)

# Save SVG
with open("output.svg", "w") as f:
    f.write(output["svg"])

# Save image
image_data = base64.b64decode(output["image"])
image = Image.open(io.BytesIO(image_data))
image.save("output.png")

Model Parameters

  • prompt (string, required): Text description of the desired output
  • negative_prompt (string, optional): Text to avoid in the generation
  • num_paths (integer, optional): Number of paths in the SVG
  • guidance_scale (float, optional): Guidance scale for the diffusion model
  • seed (integer, optional): Random seed for reproducibility

Limitations

  • The model works best with descriptive, clear prompts
  • Complex scenes may not be rendered with perfect accuracy
  • Generation time can vary based on the complexity of the prompt