prathje commited on
Commit
6a1da31
·
verified ·
1 Parent(s): cedb5cf

Upload folder using huggingface_hub

Browse files
README.md CHANGED
@@ -10,9 +10,9 @@ app_file: space.py
10
  ---
11
 
12
  # `gradio_motioncanvasplayer`
13
- <img alt="Static Badge" src="https://img.shields.io/badge/version%20-%200.0.1%20-%20orange">
14
 
15
- Motion Canvas Player to render Motion Canvas projects
16
 
17
  ## Installation
18
 
@@ -25,20 +25,19 @@ pip install gradio_motioncanvasplayer
25
  ```python
26
 
27
  import gradio as gr
28
- from pathlib import Path
29
- import uvicorn
30
 
31
  from gradio_motioncanvasplayer import MotionCanvasPlayer
32
 
33
- project_path = "/gradio_api/file=public/project-3.17.2.js"
 
 
34
 
35
 
36
- gr.set_static_paths(paths=[Path.cwd().absolute()/"public"])
37
-
38
  demo = gr.Interface(
39
  lambda x:x,
40
  None, # interactive version of your component, not relevant for this demo
41
- MotionCanvasPlayer(project_path, auto=True, quality=0.5, width=1920, height=1080, variables="{}"), # static version of your component
42
  clear_btn=None
43
 
44
  )
 
10
  ---
11
 
12
  # `gradio_motioncanvasplayer`
13
+ <a href="https://pypi.org/project/gradio_motioncanvasplayer/" target="_blank"><img alt="PyPI - Version" src="https://img.shields.io/pypi/v/gradio_motioncanvasplayer"></a>
14
 
15
+ This component displays Motion Canvas projects directly in the browser. [Motion Canvas](https://motioncanvas.io/) is a library for generating animations, videos or presentations via the Canvas API. All animations are defined by code - a great playground for AI agents. The source code for the example animation can be found at [https://github.com/prathje/gradio-motion-canvas-example](https://github.com/prathje/gradio-motion-canvas-example).
16
 
17
  ## Installation
18
 
 
25
  ```python
26
 
27
  import gradio as gr
28
+ import os
 
29
 
30
  from gradio_motioncanvasplayer import MotionCanvasPlayer
31
 
32
+ gr.set_static_paths(paths=[os.path.join(os.path.dirname(__file__), "public")])
33
+ project_local_path = os.path.join(os.path.dirname(__file__), "public/project-3.17.2.js")
34
+ project_api_path = "/gradio_api/file=" + project_local_path
35
 
36
 
 
 
37
  demo = gr.Interface(
38
  lambda x:x,
39
  None, # interactive version of your component, not relevant for this demo
40
+ MotionCanvasPlayer(project_api_path, auto=True, quality=0.5, width=1920, height=1080, variables="{}"), # static version of your component
41
  clear_btn=None
42
 
43
  )
app.py CHANGED
@@ -1,19 +1,18 @@
1
 
2
  import gradio as gr
3
- from pathlib import Path
4
- import uvicorn
5
 
6
  from gradio_motioncanvasplayer import MotionCanvasPlayer
7
 
8
- project_path = "/gradio_api/file=public/project-3.17.2.js"
 
 
9
 
10
 
11
- gr.set_static_paths(paths=[Path.cwd().absolute()/"public"])
12
-
13
  demo = gr.Interface(
14
  lambda x:x,
15
  None, # interactive version of your component, not relevant for this demo
16
- MotionCanvasPlayer(project_path, auto=True, quality=0.5, width=1920, height=1080, variables="{}"), # static version of your component
17
  clear_btn=None
18
 
19
  )
 
1
 
2
  import gradio as gr
3
+ import os
 
4
 
5
  from gradio_motioncanvasplayer import MotionCanvasPlayer
6
 
7
+ gr.set_static_paths(paths=[os.path.join(os.path.dirname(__file__), "public")])
8
+ project_local_path = os.path.join(os.path.dirname(__file__), "public/project-3.17.2.js")
9
+ project_api_path = "/gradio_api/file=" + project_local_path
10
 
11
 
 
 
12
  demo = gr.Interface(
13
  lambda x:x,
14
  None, # interactive version of your component, not relevant for this demo
15
+ MotionCanvasPlayer(project_api_path, auto=True, quality=0.5, width=1920, height=1080, variables="{}"), # static version of your component
16
  clear_btn=None
17
 
18
  )
public/project-3.17.2.js CHANGED
The diff for this file is too large to render. See raw diff
 
space.py CHANGED
@@ -21,7 +21,7 @@ with gr.Blocks(
21
  # `gradio_motioncanvasplayer`
22
 
23
  <div style="display: flex; gap: 7px;">
24
- <img alt="Static Badge" src="https://img.shields.io/badge/version%20-%200.0.1%20-%20orange">
25
  </div>
26
 
27
  Motion Canvas Player to render Motion Canvas projects
@@ -40,20 +40,19 @@ pip install gradio_motioncanvasplayer
40
  ```python
41
 
42
  import gradio as gr
43
- from pathlib import Path
44
- import uvicorn
45
 
46
  from gradio_motioncanvasplayer import MotionCanvasPlayer
47
 
48
- project_path = "/gradio_api/file=public/project-3.17.2.js"
49
-
 
50
 
51
- gr.set_static_paths(paths=[Path.cwd().absolute()/"public"])
52
 
53
  demo = gr.Interface(
54
  lambda x:x,
55
  None, # interactive version of your component, not relevant for this demo
56
- MotionCanvasPlayer(project_path, auto=True, quality=0.5, width=1920, height=1080, variables="{}"), # static version of your component
57
  clear_btn=None
58
 
59
  )
 
21
  # `gradio_motioncanvasplayer`
22
 
23
  <div style="display: flex; gap: 7px;">
24
+ <a href="https://pypi.org/project/gradio_motioncanvasplayer/" target="_blank"><img alt="PyPI - Version" src="https://img.shields.io/pypi/v/gradio_motioncanvasplayer"></a>
25
  </div>
26
 
27
  Motion Canvas Player to render Motion Canvas projects
 
40
  ```python
41
 
42
  import gradio as gr
43
+ import os
 
44
 
45
  from gradio_motioncanvasplayer import MotionCanvasPlayer
46
 
47
+ gr.set_static_paths(paths=[os.path.join(os.path.dirname(__file__), "public")])
48
+ project_local_path = os.path.join(os.path.dirname(__file__), "public/project-3.17.2.js")
49
+ project_api_path = "/gradio_api/file=" + project_local_path
50
 
 
51
 
52
  demo = gr.Interface(
53
  lambda x:x,
54
  None, # interactive version of your component, not relevant for this demo
55
+ MotionCanvasPlayer(project_api_path, auto=True, quality=0.5, width=1920, height=1080, variables="{}"), # static version of your component
56
  clear_btn=None
57
 
58
  )
src/README.md CHANGED
@@ -10,9 +10,9 @@ app_file: space.py
10
  ---
11
 
12
  # `gradio_motioncanvasplayer`
13
- <img alt="Static Badge" src="https://img.shields.io/badge/version%20-%200.0.1%20-%20orange">
14
 
15
- Motion Canvas Player to render Motion Canvas projects
16
 
17
  ## Installation
18
 
@@ -25,20 +25,19 @@ pip install gradio_motioncanvasplayer
25
  ```python
26
 
27
  import gradio as gr
28
- from pathlib import Path
29
- import uvicorn
30
 
31
  from gradio_motioncanvasplayer import MotionCanvasPlayer
32
 
33
- project_path = "/gradio_api/file=public/project-3.17.2.js"
 
 
34
 
35
 
36
- gr.set_static_paths(paths=[Path.cwd().absolute()/"public"])
37
-
38
  demo = gr.Interface(
39
  lambda x:x,
40
  None, # interactive version of your component, not relevant for this demo
41
- MotionCanvasPlayer(project_path, auto=True, quality=0.5, width=1920, height=1080, variables="{}"), # static version of your component
42
  clear_btn=None
43
 
44
  )
 
10
  ---
11
 
12
  # `gradio_motioncanvasplayer`
13
+ <a href="https://pypi.org/project/gradio_motioncanvasplayer/" target="_blank"><img alt="PyPI - Version" src="https://img.shields.io/pypi/v/gradio_motioncanvasplayer"></a>
14
 
15
+ This component displays Motion Canvas projects directly in the browser. [Motion Canvas](https://motioncanvas.io/) is a library for generating animations, videos or presentations via the Canvas API. All animations are defined by code - a great playground for AI agents. The source code for the example animation can be found at [https://github.com/prathje/gradio-motion-canvas-example](https://github.com/prathje/gradio-motion-canvas-example).
16
 
17
  ## Installation
18
 
 
25
  ```python
26
 
27
  import gradio as gr
28
+ import os
 
29
 
30
  from gradio_motioncanvasplayer import MotionCanvasPlayer
31
 
32
+ gr.set_static_paths(paths=[os.path.join(os.path.dirname(__file__), "public")])
33
+ project_local_path = os.path.join(os.path.dirname(__file__), "public/project-3.17.2.js")
34
+ project_api_path = "/gradio_api/file=" + project_local_path
35
 
36
 
 
 
37
  demo = gr.Interface(
38
  lambda x:x,
39
  None, # interactive version of your component, not relevant for this demo
40
+ MotionCanvasPlayer(project_api_path, auto=True, quality=0.5, width=1920, height=1080, variables="{}"), # static version of your component
41
  clear_btn=None
42
 
43
  )
src/demo/app.py CHANGED
@@ -1,19 +1,18 @@
1
 
2
  import gradio as gr
3
- from pathlib import Path
4
- import uvicorn
5
 
6
  from gradio_motioncanvasplayer import MotionCanvasPlayer
7
 
8
- project_path = "/gradio_api/file=public/project-3.17.2.js"
 
 
9
 
10
 
11
- gr.set_static_paths(paths=[Path.cwd().absolute()/"public"])
12
-
13
  demo = gr.Interface(
14
  lambda x:x,
15
  None, # interactive version of your component, not relevant for this demo
16
- MotionCanvasPlayer(project_path, auto=True, quality=0.5, width=1920, height=1080, variables="{}"), # static version of your component
17
  clear_btn=None
18
 
19
  )
 
1
 
2
  import gradio as gr
3
+ import os
 
4
 
5
  from gradio_motioncanvasplayer import MotionCanvasPlayer
6
 
7
+ gr.set_static_paths(paths=[os.path.join(os.path.dirname(__file__), "public")])
8
+ project_local_path = os.path.join(os.path.dirname(__file__), "public/project-3.17.2.js")
9
+ project_api_path = "/gradio_api/file=" + project_local_path
10
 
11
 
 
 
12
  demo = gr.Interface(
13
  lambda x:x,
14
  None, # interactive version of your component, not relevant for this demo
15
+ MotionCanvasPlayer(project_api_path, auto=True, quality=0.5, width=1920, height=1080, variables="{}"), # static version of your component
16
  clear_btn=None
17
 
18
  )
src/demo/public/project-3.17.2.js CHANGED
The diff for this file is too large to render. See raw diff
 
src/demo/space.py CHANGED
@@ -21,7 +21,7 @@ with gr.Blocks(
21
  # `gradio_motioncanvasplayer`
22
 
23
  <div style="display: flex; gap: 7px;">
24
- <img alt="Static Badge" src="https://img.shields.io/badge/version%20-%200.0.1%20-%20orange">
25
  </div>
26
 
27
  Motion Canvas Player to render Motion Canvas projects
@@ -40,20 +40,19 @@ pip install gradio_motioncanvasplayer
40
  ```python
41
 
42
  import gradio as gr
43
- from pathlib import Path
44
- import uvicorn
45
 
46
  from gradio_motioncanvasplayer import MotionCanvasPlayer
47
 
48
- project_path = "/gradio_api/file=public/project-3.17.2.js"
49
-
 
50
 
51
- gr.set_static_paths(paths=[Path.cwd().absolute()/"public"])
52
 
53
  demo = gr.Interface(
54
  lambda x:x,
55
  None, # interactive version of your component, not relevant for this demo
56
- MotionCanvasPlayer(project_path, auto=True, quality=0.5, width=1920, height=1080, variables="{}"), # static version of your component
57
  clear_btn=None
58
 
59
  )
 
21
  # `gradio_motioncanvasplayer`
22
 
23
  <div style="display: flex; gap: 7px;">
24
+ <a href="https://pypi.org/project/gradio_motioncanvasplayer/" target="_blank"><img alt="PyPI - Version" src="https://img.shields.io/pypi/v/gradio_motioncanvasplayer"></a>
25
  </div>
26
 
27
  Motion Canvas Player to render Motion Canvas projects
 
40
  ```python
41
 
42
  import gradio as gr
43
+ import os
 
44
 
45
  from gradio_motioncanvasplayer import MotionCanvasPlayer
46
 
47
+ gr.set_static_paths(paths=[os.path.join(os.path.dirname(__file__), "public")])
48
+ project_local_path = os.path.join(os.path.dirname(__file__), "public/project-3.17.2.js")
49
+ project_api_path = "/gradio_api/file=" + project_local_path
50
 
 
51
 
52
  demo = gr.Interface(
53
  lambda x:x,
54
  None, # interactive version of your component, not relevant for this demo
55
+ MotionCanvasPlayer(project_api_path, auto=True, quality=0.5, width=1920, height=1080, variables="{}"), # static version of your component
56
  clear_btn=None
57
 
58
  )