Spaces:
Running
on
Zero
Running
on
Zero
File size: 4,692 Bytes
0c57d8c 3818073 0c57d8c da70cfd 0c57d8c 3818073 0c57d8c 3818073 0c57d8c d6db322 863a310 0c57d8c 078b646 1d4075b 078b646 1d4075b 078b646 1d4075b 078b646 1d4075b 078b646 1d4075b 078b646 1d4075b 078b646 1d4075b 078b646 1d4075b 078b646 1d4075b 078b646 1d4075b 078b646 1d4075b 078b646 1d4075b |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 |
---
title: 🧩 DiffuseCraft Mod (SDXL/SD1.5 Models Text-to-Image)
emoji: 🧩🖼️📦
colorFrom: red
colorTo: pink
sdk: gradio
sdk_version: 5.45.0
app_file: app.py
pinned: true
header: mini
license: mit
duplicated_from: r3gm/DiffuseCraft
short_description: Stunning images using stable diffusion.
preload_from_hub:
- madebyollin/sdxl-vae-fp16-fix config.json,diffusion_pytorch_model.safetensors
hf_oauth: true
---
## Using this Space programmatically
You can call this Space from Python (via `gradio_client`) or from plain `curl`.
> ⚠️ Note: This README may lag behind the actual API definition shown in the Space’s “View API” page.
> If something does not work, always double-check the latest argument list and endpoint names there.
Assumptions:
- Space ID: `John6666/DiffuseCraftMod`
- You have a valid Hugging Face access token: `hf_xxx...` (read access is enough)
- Replace `hf_xxx...` with your own token
---
### 1. Python examples (`gradio_client`)
Install:
```bash
pip install gradio_client
````
#### 1.1 Synchronous API – `generate_image`
```python
from gradio_client import Client
client = Client("John6666/DiffuseCraftMod", hf_token="hf_xxx...")
status, images, info = client.predict(
# Core text controls
prompt="Hello!!",
negative_prompt=(
"lowres, bad anatomy, bad hands, missing fingers, extra digit, "
"fewer digits, worst quality, low quality"
),
# Basic generation controls
num_images=1,
num_inference_steps=28,
guidance_scale=7.0,
clip_skip=0,
seed=-1,
# Canvas / model / task (optional, server has defaults)
height=1024,
width=1024,
model_name="votepurchase/animagine-xl-3.1",
vae_model="None",
task="txt2img",
# All other arguments are optional; defaults match the UI
api_name="/generate_image",
)
print(status) # e.g. "COMPLETE"
print(images) # list of image paths / URLs
print(info) # generation metadata (seed, model, etc.)
```
#### 1.2 Streaming API – `generate_image_stream`
```python
from gradio_client import Client
client = Client("John6666/DiffuseCraftMod", hf_token="hf_xxx...")
job = client.submit(
prompt="Hello!!",
negative_prompt=(
"lowres, bad anatomy, bad hands, missing fingers, extra digit, "
"fewer digits, worst quality, low quality"
),
num_images=1,
num_inference_steps=28,
guidance_scale=7.0,
clip_skip=0,
seed=-1,
height=1024,
width=1024,
model_name="votepurchase/animagine-xl-3.1",
vae_model="None",
task="txt2img",
api_name="/generate_image_stream",
)
for status, images, info in job:
# You will see progress messages, intermediate previews, and the final result.
print(status, images, info)
```
You can stop iterating once you see a `"COMPLETE"` status if you only care about the final output.
---
### 2. `curl` examples
When calling from `curl`, include your HF token; anonymous calls may be rate-limited or rejected.
```bash
export HF_TOKEN="hf_xxx..." # your Hugging Face access token
```
The `data` field is a positional array. The order must match the function signature.
For simplicity, the examples below only send the first few arguments and rely on server defaults for the rest.
#### 2.1 Synchronous API – `generate_image`
```bash
curl -X POST "https://john6666-diffusecraftmod.hf.space/call/generate_image" \
-H "Authorization: Bearer $HF_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"data": [
"Hello!!", // prompt
"lowres, bad anatomy, bad hands, missing fingers, extra digit, fewer digits, worst quality, low quality", // negative_prompt
1, // num_images
28, // num_inference_steps
7.0, // guidance_scale
0, // clip_skip
-1 // seed
// All subsequent parameters will use their default values
]
}'
```
#### 2.2 Streaming API – `generate_image_stream`
```bash
curl -X POST "https://john6666-diffusecraftmod.hf.space/call/generate_image_stream" \
-H "Authorization: Bearer $HF_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"data": [
"Hello!!",
"lowres, bad anatomy, bad hands, missing fingers, extra digit, fewer digits, worst quality, low quality",
1,
28,
7.0,
0,
-1
]
}'
```
For full parameter coverage (all advanced options such as LoRAs, ControlNet, IP-Adapter, etc.),
refer to the Space’s “View API” page and adapt the examples above accordingly.
|