balthou commited on
Commit
169b2fd
·
1 Parent(s): 80f08b9

update tutorial

Browse files
Files changed (3) hide show
  1. app.py +6 -1
  2. interactivity.py +16 -2
  3. tutorial.md +1 -2
app.py CHANGED
@@ -11,10 +11,15 @@ if __name__ == "__main__":
11
  backend = args.backend
12
  extra_markdown = open("tutorial.md", 'r').read()
13
  markdown_description = "# 🔍 READ TUTORIAL HERE \n"
 
 
 
14
  markdown_description += "# Source code for this tutorial \n"
15
  markdown_description += "## Processing blocks & pipeline (~ production code, no interactivity) \n"
 
16
  markdown_description += "```python\n"+open("library.py", 'r').read()+"```\n"
17
- markdown_description += "## Add interactivity \n"
 
18
  markdown_description += "```python\n"+open("interactivity.py", 'r').read()+"```\n"
19
  markdown_description += "\n"+extra_markdown
20
  run_interactive_pipeline(
 
11
  backend = args.backend
12
  extra_markdown = open("tutorial.md", 'r').read()
13
  markdown_description = "# 🔍 READ TUTORIAL HERE \n"
14
+
15
+ markdown_description += '# Setup\n' + '`pip install interactive-pipe`' + '\n\n'
16
+ markdown_description += r'More info on [Interactive Pipe Website](https://balthazarneveu.github.io/interactive_pipe/)'+ '\n'
17
  markdown_description += "# Source code for this tutorial \n"
18
  markdown_description += "## Processing blocks & pipeline (~ production code, no interactivity) \n"
19
+ markdown_description += "`library.py`\n"
20
  markdown_description += "```python\n"+open("library.py", 'r').read()+"```\n"
21
+ markdown_description += "## Add interactivity\n"
22
+ markdown_description += "`app.py`\n"
23
  markdown_description += "```python\n"+open("interactivity.py", 'r').read()+"```\n"
24
  markdown_description += "\n"+extra_markdown
25
  run_interactive_pipeline(
interactivity.py CHANGED
@@ -1,10 +1,11 @@
1
  from interactive_pipe import interactive_pipeline, interactive
2
  from library import (gen_color, modify_geometry, change_color,
3
  compare_by_splitting, tutorial_pipeline)
 
4
  # --------------------------------------------------------------
5
 
6
 
7
- def add_interactivity():
8
  # Depending on the level of control you want,
9
  # you can add more or less controls to the pipeline
10
  interactive(
@@ -22,7 +23,10 @@ def add_interactivity():
22
  )(gen_color)
23
 
24
 
25
- def run_interactive_pipeline(backend="gradio", markdown_description="# Tutorial"):
 
 
 
26
  add_interactivity()
27
  playable_tutorial_pipeline = interactive_pipeline(
28
  gui=backend,
@@ -30,3 +34,13 @@ def run_interactive_pipeline(backend="gradio", markdown_description="# Tutorial"
30
  markdown_description=markdown_description
31
  )(tutorial_pipeline)
32
  playable_tutorial_pipeline()
 
 
 
 
 
 
 
 
 
 
 
1
  from interactive_pipe import interactive_pipeline, interactive
2
  from library import (gen_color, modify_geometry, change_color,
3
  compare_by_splitting, tutorial_pipeline)
4
+ import argparse
5
  # --------------------------------------------------------------
6
 
7
 
8
+ def add_interactivity() -> None:
9
  # Depending on the level of control you want,
10
  # you can add more or less controls to the pipeline
11
  interactive(
 
23
  )(gen_color)
24
 
25
 
26
+ def run_interactive_pipeline(
27
+ backend: str = "gradio",
28
+ markdown_description: str = "# Tuto"
29
+ ) -> None:
30
  add_interactivity()
31
  playable_tutorial_pipeline = interactive_pipeline(
32
  gui=backend,
 
34
  markdown_description=markdown_description
35
  )(tutorial_pipeline)
36
  playable_tutorial_pipeline()
37
+
38
+
39
+ if __name__ == "__main__":
40
+ BACKEND_OPTIONS = ["gradio", "qt"]
41
+ parser = argparse.ArgumentParser()
42
+ parser.add_argument("-b", "--backend", type=str,
43
+ choices=BACKEND_OPTIONS, default=BACKEND_OPTIONS[0])
44
+ args = parser.parse_args()
45
+ run_interactive_pipeline(backend=args.backend,
46
+ markdown_description="# Tutorial")
tutorial.md CHANGED
@@ -1,5 +1,4 @@
1
- # Tutorial
2
-
3
 
4
 
5
  ## Keep separation between "production code" (library / not interactive) & interactivity
 
1
+ # Advice
 
2
 
3
 
4
  ## Keep separation between "production code" (library / not interactive) & interactivity