Make negative_prompt/hf_token optional in API schema; document usage
Browse files- README.md +8 -2
- __pycache__/app.cpython-313.pyc +0 -0
- app.py +3 -1
README.md
CHANGED
|
@@ -37,16 +37,18 @@ to track upstream's positional, UI-derived signature.
|
|
| 37 |
| `sampler_type` | str | `pingpong` | `pingpong`, `euler`, `rk4`, `dpmpp` |
|
| 38 |
| `seed` | int | 0 | 0 = random |
|
| 39 |
| `negative_prompt` | str | `""` | routes via upstream `/infer_advanced` when set |
|
|
|
|
| 40 |
|
| 41 |
## Usage
|
| 42 |
|
| 43 |
```python
|
| 44 |
from gradio_client import Client
|
| 45 |
|
| 46 |
-
client = Client("
|
| 47 |
wav_path, status = client.predict(
|
| 48 |
prompt="Warm analog house groove, deep sub bass, shuffled hats 122 BPM",
|
| 49 |
duration=30,
|
|
|
|
| 50 |
api_name="/generate",
|
| 51 |
)
|
| 52 |
print(status, wav_path)
|
|
@@ -54,8 +56,12 @@ print(status, wav_path)
|
|
| 54 |
|
| 55 |
## Configuration
|
| 56 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 57 |
| variable | purpose |
|
| 58 |
|---|---|
|
| 59 |
-
| `HF_TOKEN` | Space secret. Presented to upstream so ZeroGPU quota is charged to its owner. Without it, calls run anonymously and hit tighter limits. |
|
| 60 |
| `UPSTREAM_SPACE` | Override the upstream Space id. Defaults to `stabilityai/stable-audio-3`. |
|
| 61 |
| `JOB_TIMEOUT` | Wall-clock budget per upstream job, including queue wait. Defaults to `900` seconds. |
|
|
|
|
|
|
| 37 |
| `sampler_type` | str | `pingpong` | `pingpong`, `euler`, `rk4`, `dpmpp` |
|
| 38 |
| `seed` | int | 0 | 0 = random |
|
| 39 |
| `negative_prompt` | str | `""` | routes via upstream `/infer_advanced` when set |
|
| 40 |
+
| `hf_token` | str | — | **required**; your own HF token (a read token suffices) |
|
| 41 |
|
| 42 |
## Usage
|
| 43 |
|
| 44 |
```python
|
| 45 |
from gradio_client import Client
|
| 46 |
|
| 47 |
+
client = Client("sleeper371/stable-audio-3-medium-api")
|
| 48 |
wav_path, status = client.predict(
|
| 49 |
prompt="Warm analog house groove, deep sub bass, shuffled hats 122 BPM",
|
| 50 |
duration=30,
|
| 51 |
+
hf_token="hf_...", # your token — your quota
|
| 52 |
api_name="/generate",
|
| 53 |
)
|
| 54 |
print(status, wav_path)
|
|
|
|
| 56 |
|
| 57 |
## Configuration
|
| 58 |
|
| 59 |
+
This Space stores **no credentials**. Each caller passes their own `hf_token`,
|
| 60 |
+
which is forwarded to upstream so ZeroGPU quota is charged to that caller — never
|
| 61 |
+
to the Space owner. Tokens are never logged or persisted.
|
| 62 |
+
|
| 63 |
| variable | purpose |
|
| 64 |
|---|---|
|
|
|
|
| 65 |
| `UPSTREAM_SPACE` | Override the upstream Space id. Defaults to `stabilityai/stable-audio-3`. |
|
| 66 |
| `JOB_TIMEOUT` | Wall-clock budget per upstream job, including queue wait. Defaults to `900` seconds. |
|
| 67 |
+
| `HTTPX_TIMEOUT` | HTTP timeout, which bounds the *download* of the result WAV (~67 MB at the 380s maximum). Defaults to `600` seconds. |
|
__pycache__/app.cpython-313.pyc
CHANGED
|
Binary files a/__pycache__/app.cpython-313.pyc and b/__pycache__/app.cpython-313.pyc differ
|
|
|
app.py
CHANGED
|
@@ -225,7 +225,7 @@ SA3 variant), proxied from [`{UPSTREAM}`](https://huggingface.co/spaces/{UPSTREA
|
|
| 225 |
```python
|
| 226 |
from gradio_client import Client
|
| 227 |
|
| 228 |
-
client = Client("
|
| 229 |
wav_path, status = client.predict(
|
| 230 |
prompt="Warm analog house groove, deep sub bass, shuffled hats 122 BPM",
|
| 231 |
duration=30,
|
|
@@ -247,6 +247,7 @@ with gr.Blocks(title="Stable Audio 3 Medium API") as demo:
|
|
| 247 |
lines=3,
|
| 248 |
)
|
| 249 |
hf_token = gr.Textbox(
|
|
|
|
| 250 |
label="Your Hugging Face token",
|
| 251 |
info="Forwarded to the upstream ZeroGPU Space so the quota is "
|
| 252 |
"charged to you. Never stored.",
|
|
@@ -254,6 +255,7 @@ with gr.Blocks(title="Stable Audio 3 Medium API") as demo:
|
|
| 254 |
type="password",
|
| 255 |
)
|
| 256 |
negative_prompt = gr.Textbox(
|
|
|
|
| 257 |
label="Negative prompt (optional)",
|
| 258 |
placeholder="lo-fi, distorted, vocals",
|
| 259 |
lines=1,
|
|
|
|
| 225 |
```python
|
| 226 |
from gradio_client import Client
|
| 227 |
|
| 228 |
+
client = Client("sleeper371/stable-audio-3-medium-api")
|
| 229 |
wav_path, status = client.predict(
|
| 230 |
prompt="Warm analog house groove, deep sub bass, shuffled hats 122 BPM",
|
| 231 |
duration=30,
|
|
|
|
| 247 |
lines=3,
|
| 248 |
)
|
| 249 |
hf_token = gr.Textbox(
|
| 250 |
+
value="",
|
| 251 |
label="Your Hugging Face token",
|
| 252 |
info="Forwarded to the upstream ZeroGPU Space so the quota is "
|
| 253 |
"charged to you. Never stored.",
|
|
|
|
| 255 |
type="password",
|
| 256 |
)
|
| 257 |
negative_prompt = gr.Textbox(
|
| 258 |
+
value="",
|
| 259 |
label="Negative prompt (optional)",
|
| 260 |
placeholder="lo-fi, distorted, vocals",
|
| 261 |
lines=1,
|