Port to interactive_pipe 0.9.4 (context proxy) and gradio 6
Browse files- core.py / core_audio.py use the `context` proxy instead of a
`context={}` keyword argument (removed in interactive_pipe 0.9.0);
the pipeline-level context={"initialized_param": 42} is unchanged
- requirements.txt: pin interactive-pipe==0.9.4
- README.md: sdk_version 6.32.0 (current gradio), python_version 3.12
- README.md +2 -1
- core.py +2 -3
- core_audio.py +2 -1
- requirements.txt +1 -1
README.md
CHANGED
|
@@ -4,7 +4,8 @@ emoji: 🎓
|
|
| 4 |
colorFrom: green
|
| 5 |
colorTo: indigo
|
| 6 |
sdk: gradio
|
| 7 |
-
sdk_version:
|
|
|
|
| 8 |
app_file: app.py
|
| 9 |
pinned: false
|
| 10 |
license: cc
|
|
|
|
| 4 |
colorFrom: green
|
| 5 |
colorTo: indigo
|
| 6 |
sdk: gradio
|
| 7 |
+
sdk_version: 6.32.0
|
| 8 |
+
python_version: "3.12"
|
| 9 |
app_file: app.py
|
| 10 |
pinned: false
|
| 11 |
license: cc
|
core.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
# "Production code"
|
| 2 |
import numpy as np
|
| 3 |
-
from interactive_pipe import Curve, SingleCurve
|
| 4 |
|
| 5 |
# -----------------
|
| 6 |
# Processing blocks
|
|
@@ -10,7 +10,6 @@ from interactive_pipe import Curve, SingleCurve
|
|
| 10 |
def gen_color(
|
| 11 |
frequency: int = 0, # discrete slider (int)
|
| 12 |
isotropy: float = 0., # continuous slider (float)
|
| 13 |
-
context={} # global parameters (dict)
|
| 14 |
) -> np.ndarray:
|
| 15 |
# context allows sharing information between processing blocks.
|
| 16 |
# Let's share the frequency value for further use.
|
|
@@ -52,7 +51,7 @@ def compare_by_splitting(
|
|
| 52 |
return out
|
| 53 |
|
| 54 |
|
| 55 |
-
def extract_profile(img: np.ndarray
|
| 56 |
# context allows sharing information between processing blocks
|
| 57 |
frequency = context.get('freq', 0)
|
| 58 |
init_shared_param = context.get(
|
|
|
|
| 1 |
# "Production code"
|
| 2 |
import numpy as np
|
| 3 |
+
from interactive_pipe import Curve, SingleCurve, context
|
| 4 |
|
| 5 |
# -----------------
|
| 6 |
# Processing blocks
|
|
|
|
| 10 |
def gen_color(
|
| 11 |
frequency: int = 0, # discrete slider (int)
|
| 12 |
isotropy: float = 0., # continuous slider (float)
|
|
|
|
| 13 |
) -> np.ndarray:
|
| 14 |
# context allows sharing information between processing blocks.
|
| 15 |
# Let's share the frequency value for further use.
|
|
|
|
| 51 |
return out
|
| 52 |
|
| 53 |
|
| 54 |
+
def extract_profile(img: np.ndarray) -> Curve:
|
| 55 |
# context allows sharing information between processing blocks
|
| 56 |
frequency = context.get('freq', 0)
|
| 57 |
init_shared_param = context.get(
|
core_audio.py
CHANGED
|
@@ -1,7 +1,8 @@
|
|
| 1 |
import numpy as np
|
|
|
|
| 2 |
|
| 3 |
|
| 4 |
-
def create_audio(img
|
| 5 |
audio_length_seconds = 0.5
|
| 6 |
time_axis = np.linspace(0, audio_length_seconds,
|
| 7 |
int(audio_length_seconds*44100))
|
|
|
|
| 1 |
import numpy as np
|
| 2 |
+
from interactive_pipe import context
|
| 3 |
|
| 4 |
|
| 5 |
+
def create_audio(img):
|
| 6 |
audio_length_seconds = 0.5
|
| 7 |
time_axis = np.linspace(0, audio_length_seconds,
|
| 8 |
int(audio_length_seconds*44100))
|
requirements.txt
CHANGED
|
@@ -1 +1 @@
|
|
| 1 |
-
interactive-pipe
|
|
|
|
| 1 |
+
interactive-pipe==0.9.4
|