feat: add basic webui matching stable-audio CLI options#34
Conversation
|
Thanks for this contribution! I wonder if you think it would just be better to merge this into the existing gradio ui? |
218ac78 to
929f231
Compare
|
Thanks, that makes sense. I revised the PR to merge the missing functionality into the existing Gradio UI instead of Updated scope:
I left model selection as a launch-time option for now since the existing UI is built around the loaded model’s |
There was a problem hiding this comment.
Pull request overview
This PR adds support for specifying multiple inpainting regions in the Gradio UI by switching the inpaint start/end inputs to comma-separated text fields and introducing a shared parser/validator for those region inputs.
Changes:
- Added
parse_inpaint_regions()to parse/validate comma-separated inpaint start/end regions and wired it intogenerate_cond(). - Updated the Gradio UI to use textboxes for inpaint regions and added a batch size control.
- Added unit tests for
parse_inpaint_regions().
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
stable_audio_3/interface/diffusion_cond.py |
Adds region CSV parsing/validation, updates generate args, and adjusts Gradio inputs (inpaint + batch size). |
tests/test_gradio_interface.py |
Adds tests covering single/multi/empty/invalid inpaint region parsing. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| def parse(value): | ||
| values = [item.strip() for item in str(value or "").split(",") if item.strip()] | ||
| try: | ||
| return [float(item) for item in values] | ||
| except ValueError as exc: | ||
| raise gr.Error("Inpaint regions must be comma-separated numbers.") from exc |
| "cfg_interval": (cfg_interval_min, cfg_interval_max), | ||
| "lora_configs": lora_configs, | ||
| "batch_size": batch_size, | ||
| "batch_size": int(batch_size), |
| def test_parse_invalid_inpaint_regions(starts, ends): | ||
| with pytest.raises(Exception): | ||
| parse_inpaint_regions(starts, ends) |
| def parse_inpaint_regions(starts_csv, ends_csv): | ||
| """Parse matching comma-separated inpaint start/end regions.""" | ||
| def parse(value): |
|
Looks good, thanks! |
Summary:
Adds a minimal Gradio WebUI that maps directly to the main stable-audio CLI options, intended as a simple UI path for users who want CLI-parity controls.