Spaces:
Sleeping
Sleeping
Download interactivity.py from balthou/interactive-pipe-tutorial: direct link, hf CLI and curl.
- Browser
- Download file 1.09 kB
-
https://huggingface.co/spaces/balthou/interactive-pipe-tutorial/resolve/74f19b4e4b4b9af2bd4d76a359d58aed486e460e/interactivity.py
- Command line
-
hf download hf://spaces/balthou/interactive-pipe-tutorial@74f19b4e4b4b9af2bd4d76a359d58aed486e460e/interactivity.py
-
curl -L -o interactivity.py https://huggingface.co/spaces/balthou/interactive-pipe-tutorial/resolve/74f19b4e4b4b9af2bd4d76a359d58aed486e460e/interactivity.py
1.09 kB
| from interactive_pipe import interactive_pipeline, interactive | |
| from library import (gen_color, modify_geometry, change_color, | |
| compare_by_splitting, tutorial_pipeline) | |
| # -------------------------------------------------------------- | |
| def add_interactivity(): | |
| # Depending on the level of control you want, | |
| # you can add more or less controls to the pipeline | |
| interactive( | |
| ratio=(0.5, [0., 1.], "Side by Side comparison") | |
| )(compare_by_splitting) | |
| interactive( | |
| bnw=(True, "Black and White") | |
| )(change_color) | |
| interactive( | |
| effect=("flip", ["flip", "mirror", "flip+mirror", "identity"]) | |
| )(modify_geometry) | |
| interactive( | |
| frequency=(80, [1, 100]), | |
| isotropy=(0.8, [0.1, 1.]) | |
| )(gen_color) | |
| def run_interactive_pipeline(backend="gradio", markdown_description="# Tutorial"): | |
| add_interactivity() | |
| playable_tutorial_pipeline = interactive_pipeline( | |
| gui=backend, | |
| cache=True, | |
| markdown_description=markdown_description | |
| )(tutorial_pipeline) | |
| playable_tutorial_pipeline() | |