π§± Define processing blocks as regular functions.
Define each atomic processing block as a regular python function.
2 kinds of elements are fed into each processing block:
β‘οΈ Arguments are signal buffers (numpy arrays).
β‘οΈ Keyword arguments are default parameters (float, int, bool, str).
βͺοΈ Function can return several signal buffers (numpy arrays).
import numpy as np
# --- Define processing blocks ---
def gen_color(green=1., decay=2):
t = np.linspace(0., 1., 256)
X, Y = np.meshgrid(np.exp(-t*decay), t)
return np.stack([X, green*Y, Y[::-1]], -1)
def flip_img(img, flip=True):
out = img[::-1] if flip else img.copy()
return out, img[:, ::-1]
def amplify(img, amp="L"):
ratio = {"S":4, "M":3, "L": 2, XL":1}[amp]
return 1/ratio*img
π Define a pipeline and output layout.
π Chain processing blocks to define a pipeline.
πͺ Output layout is specified by the return statement.
return [A, B, C] |
return [[A, B], [C, D]] |
return [[A], [B]] |
---|---|---|
# --- Define pipeline ---
def pipe():
inp = gen_color()
out_flip, out_mirror = flip_img(inp)
out = amplify(out_mirror)
return [inp, out_flip, out]
# Display 3 images side by side
πΉοΈ Add controls to processing blocks.
ποΈ By decorating a processing block, Interactive pipe adds controls.
π Controls are automatically created for each keyword argument.
string |
boolean |
integer |
float |
---|---|---|---|
Amplify |
Flip |
Color Decay 3 |
Green amount 0.5 |
import interactive_pipe as ip
# --- Decorate processing blocks ---
ip.interactive(
green=(1., [0., 1.], "Green amount"),
decay=(2 , [0 , 10], "Color decay")
)(gen_color)
ip.interactive(
amp=("L", ["S", "M", "L", "XL"], "Amplify")
)(amplify)
ip.interactive(flip=(True, "Flip"))(flip_img)
βΆοΈ Launch interactive pipe.
π― Interactive Pipe deals with several graphical interfaces backends.
π« No code changes needed: Same GUI, no matter the backend .
# --- Decorate pipeline & run ---
ip.interactive_pipeline(gui="qt")(pipe)()
π Multiple backends support
Interactive Pipe offers a range of options for displaying your code, no code changes needed.
π» PyQT
β Dynamic control of output layouts.
β Keyboard shortcuts, Full screen.
β Audio Playback.
Sample python code on github »
β¨οΈ Ideal during development, debug sessions and code reviews.
π€ Gradio
β Share your pipeline with others.
β Easily host in Hugging Face spaces.
β Runs in a browser.
Example: Basic Image editing »
π§ͺ Ideal to share ideas inside a scientific team, ready for demos.
π Notebooks
β Annotate with markdown and equations.
β Easily host on Google Colab.
β Based on Jupyter IPywidget.
Example: Signal processing notebook »
π§βπ Ideal for students projects (computer vision, machine learning).
π Features
π π· Images and Curves are supported by Interactive Pipe.
πΆ π§ Live audio playback is supported using Qt and Gradio GUI.
ποΈ πΎ A cache mechanism allows skipping computation if the inputs and sliders have not changed.
βοΈ Motivations
β Empower engineers and developers to showcase their expertise.
π Visual debugging made intuitive: Traditional debugging tools often fall short for image and audio algorithms, where simple breakpoints aren't enough. Visual tools provide clearer insights.
π§ββοΈ Elevate code reviews: Go beyond unit testsβdemonstrate your code's functionality visually, making it easier to convince peers that it works as expected.
π Seamless production integration: Maintain a clean separation between production code and graphical interfaces. By decorating processing blocks in a dedicated file, your pipeline remain functional whether run in a GUI or headlessly via the command line.
π¬ Built by scientists, for scientists. Designed with research-driven workflows in mind.
π₯ Real use cases
π§Έ Tutorial is written as a comprehensive toy example (to understand the concept).
π But Interactive Pipe can be used on real use cases.
π Check by yourself with the examples provided on Image, Audio and Machine learning.
π Tutorials
π Many tutorials are available from basic to advanced features of interactive pipe.
π Acknowledgement
- Main contributor: Balthazar Neveu
- Additional contributors: Emmanuel Chaboud, Giuseppe Moschetti, Sylvain Leroy
- Additional testers: Jamy Lafenetre, Mathilde Dupouy, Matthieu Dinot