hmb HF staff commited on
Commit
5ddc4d5
1 Parent(s): ae493f5

Upload folder using huggingface_hub

Browse files
Dockerfile ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ FROM python:3.9
3
+
4
+ WORKDIR /code
5
+
6
+ COPY --link --chown=1000 . .
7
+
8
+ RUN mkdir -p /tmp/cache/
9
+ RUN chmod a+rwx -R /tmp/cache/
10
+ ENV TRANSFORMERS_CACHE=/tmp/cache/
11
+
12
+ RUN pip install --no-cache-dir -r requirements.txt
13
+
14
+ ENV PYTHONUNBUFFERED=1 GRADIO_ALLOW_FLAGGING=never GRADIO_NUM_PORTS=1 GRADIO_SERVER_NAME=0.0.0.0 GRADIO_SERVER_PORT=7860 SYSTEM=spaces
15
+
16
+ CMD ["python", "space.py"]
README.md CHANGED
@@ -1,10 +1,17 @@
 
1
  ---
2
- title: Gradio Coolcanvas
3
- emoji: 🔥
4
- colorFrom: yellow
5
- colorTo: gray
6
  sdk: docker
7
  pinned: false
 
8
  ---
9
 
10
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
 
 
 
 
1
+
2
  ---
3
+ tags: [gradio-custom-component,gradio-template-Group]
4
+ title: gradio_coolcanvas V0.0.1
5
+ colorFrom: blue
6
+ colorTo: red
7
  sdk: docker
8
  pinned: false
9
+ license: apache-2.0
10
  ---
11
 
12
+
13
+ # Name: gradio_coolcanvas
14
+
15
+ Description: Python library for easily interacting with trained machine learning models
16
+
17
+ Install with: pip install gradio_coolcanvas
__init__.py ADDED
File without changes
__pycache__/__init__.cpython-311.pyc ADDED
Binary file (155 Bytes). View file
 
__pycache__/app.cpython-311.pyc ADDED
Binary file (10.3 kB). View file
 
app.py ADDED
@@ -0,0 +1,117 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ import gradio as gr
3
+ from gradio_coolcanvas import CoolCanvas
4
+
5
+
6
+ def greet(name):
7
+ return "Hello " + name + "!"
8
+
9
+ with gr.Blocks() as demo:
10
+ with CoolCanvas():
11
+ gr.Markdown("### This is a couple of elements without any gr.Group. Form elements naturally group together anyway.")
12
+ gr.Textbox("A")
13
+ gr.Number(3)
14
+ gr.Button()
15
+ gr.Image()
16
+ gr.Slider()
17
+
18
+ gr.Markdown("### This is the same set put in a gr.Group.")
19
+ with gr.Group():
20
+ gr.Textbox("A")
21
+ gr.Number(3)
22
+ gr.Button()
23
+ gr.Image()
24
+ gr.Slider()
25
+
26
+ gr.Markdown("### Now in a Row, no group.")
27
+ with gr.Row():
28
+ gr.Textbox("A")
29
+ gr.Number(3)
30
+ gr.Button()
31
+ gr.Image()
32
+ gr.Slider()
33
+
34
+ gr.Markdown("### Now in a Row in a group.")
35
+ with gr.Group():
36
+ with gr.Row():
37
+ gr.Textbox("A")
38
+ gr.Number(3)
39
+ gr.Button()
40
+ gr.Image()
41
+ gr.Slider()
42
+
43
+ gr.Markdown("### Several rows grouped together.")
44
+ with gr.Group():
45
+ with gr.Row():
46
+ gr.Textbox("A")
47
+ gr.Number(3)
48
+ gr.Button()
49
+ with gr.Row():
50
+ gr.Image()
51
+ gr.Audio()
52
+
53
+ gr.Markdown("### Several columns grouped together. If columns are uneven, there is a gray group background.")
54
+ with gr.Group():
55
+ with gr.Row():
56
+ with gr.Column():
57
+ name = gr.Textbox(label="Name")
58
+ btn = gr.Button("Hello")
59
+ gr.Dropdown(["a", "b", "c"], interactive=True)
60
+ gr.Number()
61
+ gr.Textbox()
62
+ with gr.Column():
63
+ gr.Image()
64
+ gr.Dropdown(["a", "b", "c"], interactive=True)
65
+ with gr.Row():
66
+ gr.Number(scale=2)
67
+ gr.Textbox()
68
+
69
+ gr.Markdown("### container=False removes label, padding, and block border, placing elements 'directly' on background.")
70
+ gr.Radio([1,2,3], container=False)
71
+ gr.Textbox(container=False)
72
+ gr.Image("https://picsum.photos/id/237/200/300", container=False, height=200)
73
+
74
+ gr.Markdown("### Textbox, Dropdown, and Number input boxes takes up full space when within a group without a container.")
75
+
76
+
77
+ with gr.Group():
78
+ name = gr.Textbox(label="Name")
79
+ output = gr.Textbox(show_label=False, container=False)
80
+ greet_btn = gr.Button("Greet")
81
+ with gr.Row():
82
+ gr.Dropdown(["a", "b", "c"], interactive=True, container=False)
83
+ gr.Textbox(container=False)
84
+ gr.Number(container=False)
85
+ gr.Image(height=100)
86
+ greet_btn.click(fn=greet, inputs=name, outputs=output, api_name="greet")
87
+
88
+
89
+ gr.Markdown("### More examples")
90
+
91
+ with gr.Group():
92
+ gr.Chatbot()
93
+ with gr.Row():
94
+ name = gr.Textbox(label="Prompot", container=False)
95
+ go = gr.Button("go", scale=0)
96
+
97
+ with gr.Column():
98
+ gr.Radio([1,2,3], container=False)
99
+ gr.Slider(0, 20, container=False)
100
+
101
+ with gr.Group():
102
+ with gr.Row():
103
+ gr.Dropdown(["a", "b", "c"], interactive=True, container=False, elem_id="here2")
104
+ gr.Number(container=False)
105
+ gr.Textbox(container=False)
106
+
107
+ with gr.Row():
108
+ with gr.Column():
109
+ gr.Dropdown(["a", "b", "c"], interactive=True, container=False, elem_id="here2")
110
+ with gr.Column():
111
+ gr.Number(container=False)
112
+ with gr.Column():
113
+ gr.Textbox(container=False)
114
+
115
+
116
+ if __name__ == "__main__":
117
+ demo.launch()
css.css ADDED
@@ -0,0 +1,157 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ html {
2
+ font-family: Inter;
3
+ font-size: 16px;
4
+ font-weight: 400;
5
+ line-height: 1.5;
6
+ -webkit-text-size-adjust: 100%;
7
+ background: #fff;
8
+ color: #323232;
9
+ -webkit-font-smoothing: antialiased;
10
+ -moz-osx-font-smoothing: grayscale;
11
+ text-rendering: optimizeLegibility;
12
+ }
13
+
14
+ :root {
15
+ --space: 1;
16
+ --vspace: calc(var(--space) * 1rem);
17
+ --vspace-0: calc(3 * var(--space) * 1rem);
18
+ --vspace-1: calc(2 * var(--space) * 1rem);
19
+ --vspace-2: calc(1.5 * var(--space) * 1rem);
20
+ --vspace-3: calc(0.5 * var(--space) * 1rem);
21
+ }
22
+
23
+ .app {
24
+ max-width: 748px !important;
25
+ }
26
+
27
+ .prose p {
28
+ margin: var(--vspace) 0;
29
+ line-height: var(--vspace * 2);
30
+ font-size: 1rem;
31
+ }
32
+
33
+ code {
34
+ font-family: "Inconsolata", sans-serif;
35
+ font-size: 16px;
36
+ }
37
+
38
+ h1,
39
+ h1 code {
40
+ font-weight: 400;
41
+ line-height: calc(2.5 / var(--space) * var(--vspace));
42
+ }
43
+
44
+ h1 code {
45
+ background: none;
46
+ border: none;
47
+ letter-spacing: 0.05em;
48
+ padding-bottom: 5px;
49
+ position: relative;
50
+ padding: 0;
51
+ }
52
+
53
+ h2 {
54
+ margin: var(--vspace-1) 0 var(--vspace-2) 0;
55
+ line-height: 1em;
56
+ }
57
+
58
+ h3,
59
+ h3 code {
60
+ margin: var(--vspace-1) 0 var(--vspace-2) 0;
61
+ line-height: 1em;
62
+ }
63
+
64
+ h4,
65
+ h5,
66
+ h6 {
67
+ margin: var(--vspace-3) 0 var(--vspace-3) 0;
68
+ line-height: var(--vspace);
69
+ }
70
+
71
+ .bigtitle,
72
+ h1,
73
+ h1 code {
74
+ font-size: calc(8px * 4.5);
75
+ word-break: break-word;
76
+ }
77
+
78
+ .title,
79
+ h2,
80
+ h2 code {
81
+ font-size: calc(8px * 3.375);
82
+ font-weight: lighter;
83
+ word-break: break-word;
84
+ border: none;
85
+ background: none;
86
+ }
87
+
88
+ .subheading1,
89
+ h3,
90
+ h3 code {
91
+ font-size: calc(8px * 1.8);
92
+ font-weight: 600;
93
+ border: none;
94
+ background: none;
95
+ letter-spacing: 0.1em;
96
+ text-transform: uppercase;
97
+ }
98
+
99
+ h2 code {
100
+ padding: 0;
101
+ position: relative;
102
+ letter-spacing: 0.05em;
103
+ }
104
+
105
+ blockquote {
106
+ font-size: calc(8px * 1.1667);
107
+ font-style: italic;
108
+ line-height: calc(1.1667 * var(--vspace));
109
+ margin: var(--vspace-2) var(--vspace-2);
110
+ }
111
+
112
+ .subheading2,
113
+ h4 {
114
+ font-size: calc(8px * 1.4292);
115
+ text-transform: uppercase;
116
+ font-weight: 600;
117
+ }
118
+
119
+ .subheading3,
120
+ h5 {
121
+ font-size: calc(8px * 1.2917);
122
+ line-height: calc(1.2917 * var(--vspace));
123
+
124
+ font-weight: lighter;
125
+ text-transform: uppercase;
126
+ letter-spacing: 0.15em;
127
+ }
128
+
129
+ h6 {
130
+ font-size: calc(8px * 1.1667);
131
+ font-size: 1.1667em;
132
+ font-weight: normal;
133
+ font-style: italic;
134
+ font-family: "le-monde-livre-classic-byol", serif !important;
135
+ letter-spacing: 0px !important;
136
+ }
137
+
138
+ #start .md > *:first-child {
139
+ margin-top: 0;
140
+ }
141
+
142
+ h2 + h3 {
143
+ margin-top: 0;
144
+ }
145
+
146
+ .md hr {
147
+ border: none;
148
+ border-top: 1px solid var(--block-border-color);
149
+ margin: var(--vspace-2) 0 var(--vspace-2) 0;
150
+ }
151
+ .prose ul {
152
+ margin: var(--vspace-2) 0 var(--vspace-1) 0;
153
+ }
154
+
155
+ .gap {
156
+ gap: 0;
157
+ }
requirements.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ gradio_coolcanvas-0.0.1-py3-none-any.whl
space.py ADDED
@@ -0,0 +1,211 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ import gradio as gr
3
+ from app import demo as app
4
+ import os
5
+
6
+ _docs = {'CoolCanvas': {'description': 'CoolCanvas is a layout element within Blocks which groups together children so that\nthey do not have any padding or margin between them.\n with gr.Group():\n gr.Textbox(label="First")\n gr.Textbox(label="Last")', 'members': {'__init__': {'visible': {'type': 'bool', 'default': 'True', 'description': 'If False, group will be hidden.'}, 'elem_id': {'type': 'str | None', 'default': 'None', 'description': 'An optional string that is assigned as the id of this component in the HTML DOM. Can be used for targeting CSS styles.'}, 'elem_classes': {'type': 'list[str] | str | None', 'default': 'None', 'description': 'An optional string or list of strings that are assigned as the class of this component in the HTML DOM. Can be used for targeting CSS styles.'}, 'render': {'type': 'bool', 'default': 'True', 'description': 'If False, this layout will not be rendered in the Blocks context. Should be used if the intention is to assign event listeners now but render the component later.'}}, 'postprocess': {}}, 'events': {}}, '__meta__': {'additional_interfaces': {}}}
7
+
8
+ abs_path = os.path.join(os.path.dirname(__file__), "css.css")
9
+
10
+ with gr.Blocks(
11
+ css=abs_path,
12
+ theme=gr.themes.Default(
13
+ font_mono=[
14
+ gr.themes.GoogleFont("Inconsolata"),
15
+ "monospace",
16
+ ],
17
+ ),
18
+ ) as demo:
19
+ gr.Markdown(
20
+ """
21
+ # `gradio_coolcanvas`
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
+ Python library for easily interacting with trained machine learning models
28
+ """, elem_classes=["md-custom"], header_links=True)
29
+ app.render()
30
+ gr.Markdown(
31
+ """
32
+ ## Installation
33
+
34
+ ```bash
35
+ pip install gradio_coolcanvas
36
+ ```
37
+
38
+ ## Usage
39
+
40
+ ```python
41
+
42
+ import gradio as gr
43
+ from gradio_coolcanvas import CoolCanvas
44
+
45
+
46
+ def greet(name):
47
+ return "Hello " + name + "!"
48
+
49
+ with gr.Blocks() as demo:
50
+ with CoolCanvas():
51
+ gr.Markdown("### This is a couple of elements without any gr.Group. Form elements naturally group together anyway.")
52
+ gr.Textbox("A")
53
+ gr.Number(3)
54
+ gr.Button()
55
+ gr.Image()
56
+ gr.Slider()
57
+
58
+ gr.Markdown("### This is the same set put in a gr.Group.")
59
+ with gr.Group():
60
+ gr.Textbox("A")
61
+ gr.Number(3)
62
+ gr.Button()
63
+ gr.Image()
64
+ gr.Slider()
65
+
66
+ gr.Markdown("### Now in a Row, no group.")
67
+ with gr.Row():
68
+ gr.Textbox("A")
69
+ gr.Number(3)
70
+ gr.Button()
71
+ gr.Image()
72
+ gr.Slider()
73
+
74
+ gr.Markdown("### Now in a Row in a group.")
75
+ with gr.Group():
76
+ with gr.Row():
77
+ gr.Textbox("A")
78
+ gr.Number(3)
79
+ gr.Button()
80
+ gr.Image()
81
+ gr.Slider()
82
+
83
+ gr.Markdown("### Several rows grouped together.")
84
+ with gr.Group():
85
+ with gr.Row():
86
+ gr.Textbox("A")
87
+ gr.Number(3)
88
+ gr.Button()
89
+ with gr.Row():
90
+ gr.Image()
91
+ gr.Audio()
92
+
93
+ gr.Markdown("### Several columns grouped together. If columns are uneven, there is a gray group background.")
94
+ with gr.Group():
95
+ with gr.Row():
96
+ with gr.Column():
97
+ name = gr.Textbox(label="Name")
98
+ btn = gr.Button("Hello")
99
+ gr.Dropdown(["a", "b", "c"], interactive=True)
100
+ gr.Number()
101
+ gr.Textbox()
102
+ with gr.Column():
103
+ gr.Image()
104
+ gr.Dropdown(["a", "b", "c"], interactive=True)
105
+ with gr.Row():
106
+ gr.Number(scale=2)
107
+ gr.Textbox()
108
+
109
+ gr.Markdown("### container=False removes label, padding, and block border, placing elements 'directly' on background.")
110
+ gr.Radio([1,2,3], container=False)
111
+ gr.Textbox(container=False)
112
+ gr.Image("https://picsum.photos/id/237/200/300", container=False, height=200)
113
+
114
+ gr.Markdown("### Textbox, Dropdown, and Number input boxes takes up full space when within a group without a container.")
115
+
116
+
117
+ with gr.Group():
118
+ name = gr.Textbox(label="Name")
119
+ output = gr.Textbox(show_label=False, container=False)
120
+ greet_btn = gr.Button("Greet")
121
+ with gr.Row():
122
+ gr.Dropdown(["a", "b", "c"], interactive=True, container=False)
123
+ gr.Textbox(container=False)
124
+ gr.Number(container=False)
125
+ gr.Image(height=100)
126
+ greet_btn.click(fn=greet, inputs=name, outputs=output, api_name="greet")
127
+
128
+
129
+ gr.Markdown("### More examples")
130
+
131
+ with gr.Group():
132
+ gr.Chatbot()
133
+ with gr.Row():
134
+ name = gr.Textbox(label="Prompot", container=False)
135
+ go = gr.Button("go", scale=0)
136
+
137
+ with gr.Column():
138
+ gr.Radio([1,2,3], container=False)
139
+ gr.Slider(0, 20, container=False)
140
+
141
+ with gr.Group():
142
+ with gr.Row():
143
+ gr.Dropdown(["a", "b", "c"], interactive=True, container=False, elem_id="here2")
144
+ gr.Number(container=False)
145
+ gr.Textbox(container=False)
146
+
147
+ with gr.Row():
148
+ with gr.Column():
149
+ gr.Dropdown(["a", "b", "c"], interactive=True, container=False, elem_id="here2")
150
+ with gr.Column():
151
+ gr.Number(container=False)
152
+ with gr.Column():
153
+ gr.Textbox(container=False)
154
+
155
+
156
+ if __name__ == "__main__":
157
+ demo.launch()
158
+ ```
159
+ """, elem_classes=["md-custom"], header_links=True)
160
+
161
+
162
+ gr.Markdown("""
163
+ ## `CoolCanvas`
164
+
165
+ ### Initialization
166
+ """, elem_classes=["md-custom"], header_links=True)
167
+
168
+ gr.ParamViewer(value=_docs["CoolCanvas"]["members"]["__init__"], linkify=[])
169
+
170
+
171
+
172
+
173
+
174
+
175
+
176
+ demo.load(None, js=r"""function() {
177
+ const refs = {};
178
+ const user_fn_refs = {};
179
+ requestAnimationFrame(() => {
180
+
181
+ Object.entries(user_fn_refs).forEach(([key, refs]) => {
182
+ if (refs.length > 0) {
183
+ const el = document.querySelector(`.${key}-user-fn`);
184
+ if (!el) return;
185
+ refs.forEach(ref => {
186
+ el.innerHTML = el.innerHTML.replace(
187
+ new RegExp("\\b"+ref+"\\b", "g"),
188
+ `<a href="#h-${ref.toLowerCase()}">${ref}</a>`
189
+ );
190
+ })
191
+ }
192
+ })
193
+
194
+ Object.entries(refs).forEach(([key, refs]) => {
195
+ if (refs.length > 0) {
196
+ const el = document.querySelector(`.${key}`);
197
+ if (!el) return;
198
+ refs.forEach(ref => {
199
+ el.innerHTML = el.innerHTML.replace(
200
+ new RegExp("\\b"+ref+"\\b", "g"),
201
+ `<a href="#h-${ref.toLowerCase()}">${ref}</a>`
202
+ );
203
+ })
204
+ }
205
+ })
206
+ })
207
+ }
208
+
209
+ """)
210
+
211
+ demo.launch()
src/.gitignore ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ .eggs/
2
+ dist/
3
+ *.pyc
4
+ __pycache__/
5
+ *.py[cod]
6
+ *$py.class
7
+ __tmp/*
8
+ *.pyi
9
+ node_modules
src/README.md ADDED
@@ -0,0 +1,204 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ # `gradio_coolcanvas`
3
+ <img alt="Static Badge" src="https://img.shields.io/badge/version%20-%200.0.1%20-%20orange">
4
+
5
+ Python library for easily interacting with trained machine learning models
6
+
7
+ ## Installation
8
+
9
+ ```bash
10
+ pip install gradio_coolcanvas
11
+ ```
12
+
13
+ ## Usage
14
+
15
+ ```python
16
+
17
+ import gradio as gr
18
+ from gradio_coolcanvas import CoolCanvas
19
+
20
+
21
+ def greet(name):
22
+ return "Hello " + name + "!"
23
+
24
+ with gr.Blocks() as demo:
25
+ with CoolCanvas():
26
+ gr.Markdown("### This is a couple of elements without any gr.Group. Form elements naturally group together anyway.")
27
+ gr.Textbox("A")
28
+ gr.Number(3)
29
+ gr.Button()
30
+ gr.Image()
31
+ gr.Slider()
32
+
33
+ gr.Markdown("### This is the same set put in a gr.Group.")
34
+ with gr.Group():
35
+ gr.Textbox("A")
36
+ gr.Number(3)
37
+ gr.Button()
38
+ gr.Image()
39
+ gr.Slider()
40
+
41
+ gr.Markdown("### Now in a Row, no group.")
42
+ with gr.Row():
43
+ gr.Textbox("A")
44
+ gr.Number(3)
45
+ gr.Button()
46
+ gr.Image()
47
+ gr.Slider()
48
+
49
+ gr.Markdown("### Now in a Row in a group.")
50
+ with gr.Group():
51
+ with gr.Row():
52
+ gr.Textbox("A")
53
+ gr.Number(3)
54
+ gr.Button()
55
+ gr.Image()
56
+ gr.Slider()
57
+
58
+ gr.Markdown("### Several rows grouped together.")
59
+ with gr.Group():
60
+ with gr.Row():
61
+ gr.Textbox("A")
62
+ gr.Number(3)
63
+ gr.Button()
64
+ with gr.Row():
65
+ gr.Image()
66
+ gr.Audio()
67
+
68
+ gr.Markdown("### Several columns grouped together. If columns are uneven, there is a gray group background.")
69
+ with gr.Group():
70
+ with gr.Row():
71
+ with gr.Column():
72
+ name = gr.Textbox(label="Name")
73
+ btn = gr.Button("Hello")
74
+ gr.Dropdown(["a", "b", "c"], interactive=True)
75
+ gr.Number()
76
+ gr.Textbox()
77
+ with gr.Column():
78
+ gr.Image()
79
+ gr.Dropdown(["a", "b", "c"], interactive=True)
80
+ with gr.Row():
81
+ gr.Number(scale=2)
82
+ gr.Textbox()
83
+
84
+ gr.Markdown("### container=False removes label, padding, and block border, placing elements 'directly' on background.")
85
+ gr.Radio([1,2,3], container=False)
86
+ gr.Textbox(container=False)
87
+ gr.Image("https://picsum.photos/id/237/200/300", container=False, height=200)
88
+
89
+ gr.Markdown("### Textbox, Dropdown, and Number input boxes takes up full space when within a group without a container.")
90
+
91
+
92
+ with gr.Group():
93
+ name = gr.Textbox(label="Name")
94
+ output = gr.Textbox(show_label=False, container=False)
95
+ greet_btn = gr.Button("Greet")
96
+ with gr.Row():
97
+ gr.Dropdown(["a", "b", "c"], interactive=True, container=False)
98
+ gr.Textbox(container=False)
99
+ gr.Number(container=False)
100
+ gr.Image(height=100)
101
+ greet_btn.click(fn=greet, inputs=name, outputs=output, api_name="greet")
102
+
103
+
104
+ gr.Markdown("### More examples")
105
+
106
+ with gr.Group():
107
+ gr.Chatbot()
108
+ with gr.Row():
109
+ name = gr.Textbox(label="Prompot", container=False)
110
+ go = gr.Button("go", scale=0)
111
+
112
+ with gr.Column():
113
+ gr.Radio([1,2,3], container=False)
114
+ gr.Slider(0, 20, container=False)
115
+
116
+ with gr.Group():
117
+ with gr.Row():
118
+ gr.Dropdown(["a", "b", "c"], interactive=True, container=False, elem_id="here2")
119
+ gr.Number(container=False)
120
+ gr.Textbox(container=False)
121
+
122
+ with gr.Row():
123
+ with gr.Column():
124
+ gr.Dropdown(["a", "b", "c"], interactive=True, container=False, elem_id="here2")
125
+ with gr.Column():
126
+ gr.Number(container=False)
127
+ with gr.Column():
128
+ gr.Textbox(container=False)
129
+
130
+
131
+ if __name__ == "__main__":
132
+ demo.launch()
133
+ ```
134
+
135
+ ## `CoolCanvas`
136
+
137
+ ### Initialization
138
+
139
+ <table>
140
+ <thead>
141
+ <tr>
142
+ <th align="left">name</th>
143
+ <th align="left" style="width: 25%;">type</th>
144
+ <th align="left">default</th>
145
+ <th align="left">description</th>
146
+ </tr>
147
+ </thead>
148
+ <tbody>
149
+ <tr>
150
+ <td align="left"><code>visible</code></td>
151
+ <td align="left" style="width: 25%;">
152
+
153
+ ```python
154
+ bool
155
+ ```
156
+
157
+ </td>
158
+ <td align="left"><code>True</code></td>
159
+ <td align="left">If False, group will be hidden.</td>
160
+ </tr>
161
+
162
+ <tr>
163
+ <td align="left"><code>elem_id</code></td>
164
+ <td align="left" style="width: 25%;">
165
+
166
+ ```python
167
+ str | None
168
+ ```
169
+
170
+ </td>
171
+ <td align="left"><code>None</code></td>
172
+ <td align="left">An optional string that is assigned as the id of this component in the HTML DOM. Can be used for targeting CSS styles.</td>
173
+ </tr>
174
+
175
+ <tr>
176
+ <td align="left"><code>elem_classes</code></td>
177
+ <td align="left" style="width: 25%;">
178
+
179
+ ```python
180
+ list[str] | str | None
181
+ ```
182
+
183
+ </td>
184
+ <td align="left"><code>None</code></td>
185
+ <td align="left">An optional string or list of strings that are assigned as the class of this component in the HTML DOM. Can be used for targeting CSS styles.</td>
186
+ </tr>
187
+
188
+ <tr>
189
+ <td align="left"><code>render</code></td>
190
+ <td align="left" style="width: 25%;">
191
+
192
+ ```python
193
+ bool
194
+ ```
195
+
196
+ </td>
197
+ <td align="left"><code>True</code></td>
198
+ <td align="left">If False, this layout will not be rendered in the Blocks context. Should be used if the intention is to assign event listeners now but render the component later.</td>
199
+ </tr>
200
+ </tbody></table>
201
+
202
+
203
+
204
+
src/backend/gradio_coolcanvas/__init__.py ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+
2
+ from .coolcanvas import CoolCanvas
3
+
4
+ __all__ = ['CoolCanvas']
src/backend/gradio_coolcanvas/coolcanvas.py ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from __future__ import annotations
2
+
3
+ from gradio_client.documentation import document, set_documentation_group
4
+
5
+ from gradio.blocks import BlockContext
6
+ from gradio.component_meta import ComponentMeta
7
+
8
+ set_documentation_group("layout")
9
+
10
+
11
+ @document()
12
+ class CoolCanvas(BlockContext, metaclass=ComponentMeta):
13
+ """
14
+ CoolCanvas is a layout element within Blocks which groups together children so that
15
+ they do not have any padding or margin between them.
16
+ Example:
17
+ with gr.Group():
18
+ gr.Textbox(label="First")
19
+ gr.Textbox(label="Last")
20
+ """
21
+
22
+ EVENTS = []
23
+
24
+ def __init__(
25
+ self,
26
+ *,
27
+ visible: bool = True,
28
+ elem_id: str | None = None,
29
+ elem_classes: list[str] | str | None = None,
30
+ render: bool = True,
31
+ ):
32
+ """
33
+ Parameters:
34
+ visible: If False, group will be hidden.
35
+ elem_id: An optional string that is assigned as the id of this component in the HTML DOM. Can be used for targeting CSS styles.
36
+ elem_classes: An optional string or list of strings that are assigned as the class of this component in the HTML DOM. Can be used for targeting CSS styles.
37
+ render: If False, this layout will not be rendered in the Blocks context. Should be used if the intention is to assign event listeners now but render the component later.
38
+ """
39
+ BlockContext.__init__(
40
+ self,
41
+ visible=visible,
42
+ elem_id=elem_id,
43
+ elem_classes=elem_classes,
44
+ render=render,
45
+ )
src/backend/gradio_coolcanvas/coolcanvas.pyi ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from __future__ import annotations
2
+
3
+ from gradio_client.documentation import document, set_documentation_group
4
+
5
+ from gradio.blocks import BlockContext
6
+ from gradio.component_meta import ComponentMeta
7
+
8
+ set_documentation_group("layout")
9
+
10
+ from gradio.events import Dependency
11
+
12
+ @document()
13
+ class CoolCanvas(BlockContext, metaclass=ComponentMeta):
14
+ """
15
+ CoolCanvas is a layout element within Blocks which groups together children so that
16
+ they do not have any padding or margin between them.
17
+ Example:
18
+ with gr.Group():
19
+ gr.Textbox(label="First")
20
+ gr.Textbox(label="Last")
21
+ """
22
+
23
+ EVENTS = []
24
+
25
+ def __init__(
26
+ self,
27
+ *,
28
+ visible: bool = True,
29
+ elem_id: str | None = None,
30
+ elem_classes: list[str] | str | None = None,
31
+ render: bool = True,
32
+ ):
33
+ """
34
+ Parameters:
35
+ visible: If False, group will be hidden.
36
+ elem_id: An optional string that is assigned as the id of this component in the HTML DOM. Can be used for targeting CSS styles.
37
+ elem_classes: An optional string or list of strings that are assigned as the class of this component in the HTML DOM. Can be used for targeting CSS styles.
38
+ render: If False, this layout will not be rendered in the Blocks context. Should be used if the intention is to assign event listeners now but render the component later.
39
+ """
40
+ BlockContext.__init__(
41
+ self,
42
+ visible=visible,
43
+ elem_id=elem_id,
44
+ elem_classes=elem_classes,
45
+ render=render,
46
+ )
src/backend/gradio_coolcanvas/templates/component/index.js ADDED
The diff for this file is too large to render. See raw diff
 
src/backend/gradio_coolcanvas/templates/component/style.css ADDED
@@ -0,0 +1 @@
 
 
1
+ .edit-button.svelte-1ken6gh{position:absolute;top:0;right:0;left:100%}.moveable-line{opacity:.1}.moveable-control{opacity:.2}.moveable-origin{opacity:0}.gradio-container{overflow:visible}.hide.svelte-1ken6gh{display:none}.target.svelte-1ken6gh{margin:30px}
src/demo/__init__.py ADDED
File without changes
src/demo/app.py ADDED
@@ -0,0 +1,117 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ import gradio as gr
3
+ from gradio_coolcanvas import CoolCanvas
4
+
5
+
6
+ def greet(name):
7
+ return "Hello " + name + "!"
8
+
9
+ with gr.Blocks() as demo:
10
+ with CoolCanvas():
11
+ gr.Markdown("### This is a couple of elements without any gr.Group. Form elements naturally group together anyway.")
12
+ gr.Textbox("A")
13
+ gr.Number(3)
14
+ gr.Button()
15
+ gr.Image()
16
+ gr.Slider()
17
+
18
+ gr.Markdown("### This is the same set put in a gr.Group.")
19
+ with gr.Group():
20
+ gr.Textbox("A")
21
+ gr.Number(3)
22
+ gr.Button()
23
+ gr.Image()
24
+ gr.Slider()
25
+
26
+ gr.Markdown("### Now in a Row, no group.")
27
+ with gr.Row():
28
+ gr.Textbox("A")
29
+ gr.Number(3)
30
+ gr.Button()
31
+ gr.Image()
32
+ gr.Slider()
33
+
34
+ gr.Markdown("### Now in a Row in a group.")
35
+ with gr.Group():
36
+ with gr.Row():
37
+ gr.Textbox("A")
38
+ gr.Number(3)
39
+ gr.Button()
40
+ gr.Image()
41
+ gr.Slider()
42
+
43
+ gr.Markdown("### Several rows grouped together.")
44
+ with gr.Group():
45
+ with gr.Row():
46
+ gr.Textbox("A")
47
+ gr.Number(3)
48
+ gr.Button()
49
+ with gr.Row():
50
+ gr.Image()
51
+ gr.Audio()
52
+
53
+ gr.Markdown("### Several columns grouped together. If columns are uneven, there is a gray group background.")
54
+ with gr.Group():
55
+ with gr.Row():
56
+ with gr.Column():
57
+ name = gr.Textbox(label="Name")
58
+ btn = gr.Button("Hello")
59
+ gr.Dropdown(["a", "b", "c"], interactive=True)
60
+ gr.Number()
61
+ gr.Textbox()
62
+ with gr.Column():
63
+ gr.Image()
64
+ gr.Dropdown(["a", "b", "c"], interactive=True)
65
+ with gr.Row():
66
+ gr.Number(scale=2)
67
+ gr.Textbox()
68
+
69
+ gr.Markdown("### container=False removes label, padding, and block border, placing elements 'directly' on background.")
70
+ gr.Radio([1,2,3], container=False)
71
+ gr.Textbox(container=False)
72
+ gr.Image("https://picsum.photos/id/237/200/300", container=False, height=200)
73
+
74
+ gr.Markdown("### Textbox, Dropdown, and Number input boxes takes up full space when within a group without a container.")
75
+
76
+
77
+ with gr.Group():
78
+ name = gr.Textbox(label="Name")
79
+ output = gr.Textbox(show_label=False, container=False)
80
+ greet_btn = gr.Button("Greet")
81
+ with gr.Row():
82
+ gr.Dropdown(["a", "b", "c"], interactive=True, container=False)
83
+ gr.Textbox(container=False)
84
+ gr.Number(container=False)
85
+ gr.Image(height=100)
86
+ greet_btn.click(fn=greet, inputs=name, outputs=output, api_name="greet")
87
+
88
+
89
+ gr.Markdown("### More examples")
90
+
91
+ with gr.Group():
92
+ gr.Chatbot()
93
+ with gr.Row():
94
+ name = gr.Textbox(label="Prompot", container=False)
95
+ go = gr.Button("go", scale=0)
96
+
97
+ with gr.Column():
98
+ gr.Radio([1,2,3], container=False)
99
+ gr.Slider(0, 20, container=False)
100
+
101
+ with gr.Group():
102
+ with gr.Row():
103
+ gr.Dropdown(["a", "b", "c"], interactive=True, container=False, elem_id="here2")
104
+ gr.Number(container=False)
105
+ gr.Textbox(container=False)
106
+
107
+ with gr.Row():
108
+ with gr.Column():
109
+ gr.Dropdown(["a", "b", "c"], interactive=True, container=False, elem_id="here2")
110
+ with gr.Column():
111
+ gr.Number(container=False)
112
+ with gr.Column():
113
+ gr.Textbox(container=False)
114
+
115
+
116
+ if __name__ == "__main__":
117
+ demo.launch()
src/demo/css.css ADDED
@@ -0,0 +1,157 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ html {
2
+ font-family: Inter;
3
+ font-size: 16px;
4
+ font-weight: 400;
5
+ line-height: 1.5;
6
+ -webkit-text-size-adjust: 100%;
7
+ background: #fff;
8
+ color: #323232;
9
+ -webkit-font-smoothing: antialiased;
10
+ -moz-osx-font-smoothing: grayscale;
11
+ text-rendering: optimizeLegibility;
12
+ }
13
+
14
+ :root {
15
+ --space: 1;
16
+ --vspace: calc(var(--space) * 1rem);
17
+ --vspace-0: calc(3 * var(--space) * 1rem);
18
+ --vspace-1: calc(2 * var(--space) * 1rem);
19
+ --vspace-2: calc(1.5 * var(--space) * 1rem);
20
+ --vspace-3: calc(0.5 * var(--space) * 1rem);
21
+ }
22
+
23
+ .app {
24
+ max-width: 748px !important;
25
+ }
26
+
27
+ .prose p {
28
+ margin: var(--vspace) 0;
29
+ line-height: var(--vspace * 2);
30
+ font-size: 1rem;
31
+ }
32
+
33
+ code {
34
+ font-family: "Inconsolata", sans-serif;
35
+ font-size: 16px;
36
+ }
37
+
38
+ h1,
39
+ h1 code {
40
+ font-weight: 400;
41
+ line-height: calc(2.5 / var(--space) * var(--vspace));
42
+ }
43
+
44
+ h1 code {
45
+ background: none;
46
+ border: none;
47
+ letter-spacing: 0.05em;
48
+ padding-bottom: 5px;
49
+ position: relative;
50
+ padding: 0;
51
+ }
52
+
53
+ h2 {
54
+ margin: var(--vspace-1) 0 var(--vspace-2) 0;
55
+ line-height: 1em;
56
+ }
57
+
58
+ h3,
59
+ h3 code {
60
+ margin: var(--vspace-1) 0 var(--vspace-2) 0;
61
+ line-height: 1em;
62
+ }
63
+
64
+ h4,
65
+ h5,
66
+ h6 {
67
+ margin: var(--vspace-3) 0 var(--vspace-3) 0;
68
+ line-height: var(--vspace);
69
+ }
70
+
71
+ .bigtitle,
72
+ h1,
73
+ h1 code {
74
+ font-size: calc(8px * 4.5);
75
+ word-break: break-word;
76
+ }
77
+
78
+ .title,
79
+ h2,
80
+ h2 code {
81
+ font-size: calc(8px * 3.375);
82
+ font-weight: lighter;
83
+ word-break: break-word;
84
+ border: none;
85
+ background: none;
86
+ }
87
+
88
+ .subheading1,
89
+ h3,
90
+ h3 code {
91
+ font-size: calc(8px * 1.8);
92
+ font-weight: 600;
93
+ border: none;
94
+ background: none;
95
+ letter-spacing: 0.1em;
96
+ text-transform: uppercase;
97
+ }
98
+
99
+ h2 code {
100
+ padding: 0;
101
+ position: relative;
102
+ letter-spacing: 0.05em;
103
+ }
104
+
105
+ blockquote {
106
+ font-size: calc(8px * 1.1667);
107
+ font-style: italic;
108
+ line-height: calc(1.1667 * var(--vspace));
109
+ margin: var(--vspace-2) var(--vspace-2);
110
+ }
111
+
112
+ .subheading2,
113
+ h4 {
114
+ font-size: calc(8px * 1.4292);
115
+ text-transform: uppercase;
116
+ font-weight: 600;
117
+ }
118
+
119
+ .subheading3,
120
+ h5 {
121
+ font-size: calc(8px * 1.2917);
122
+ line-height: calc(1.2917 * var(--vspace));
123
+
124
+ font-weight: lighter;
125
+ text-transform: uppercase;
126
+ letter-spacing: 0.15em;
127
+ }
128
+
129
+ h6 {
130
+ font-size: calc(8px * 1.1667);
131
+ font-size: 1.1667em;
132
+ font-weight: normal;
133
+ font-style: italic;
134
+ font-family: "le-monde-livre-classic-byol", serif !important;
135
+ letter-spacing: 0px !important;
136
+ }
137
+
138
+ #start .md > *:first-child {
139
+ margin-top: 0;
140
+ }
141
+
142
+ h2 + h3 {
143
+ margin-top: 0;
144
+ }
145
+
146
+ .md hr {
147
+ border: none;
148
+ border-top: 1px solid var(--block-border-color);
149
+ margin: var(--vspace-2) 0 var(--vspace-2) 0;
150
+ }
151
+ .prose ul {
152
+ margin: var(--vspace-2) 0 var(--vspace-1) 0;
153
+ }
154
+
155
+ .gap {
156
+ gap: 0;
157
+ }
src/demo/space.py ADDED
@@ -0,0 +1,211 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ import gradio as gr
3
+ from app import demo as app
4
+ import os
5
+
6
+ _docs = {'CoolCanvas': {'description': 'CoolCanvas is a layout element within Blocks which groups together children so that\nthey do not have any padding or margin between them.\n with gr.Group():\n gr.Textbox(label="First")\n gr.Textbox(label="Last")', 'members': {'__init__': {'visible': {'type': 'bool', 'default': 'True', 'description': 'If False, group will be hidden.'}, 'elem_id': {'type': 'str | None', 'default': 'None', 'description': 'An optional string that is assigned as the id of this component in the HTML DOM. Can be used for targeting CSS styles.'}, 'elem_classes': {'type': 'list[str] | str | None', 'default': 'None', 'description': 'An optional string or list of strings that are assigned as the class of this component in the HTML DOM. Can be used for targeting CSS styles.'}, 'render': {'type': 'bool', 'default': 'True', 'description': 'If False, this layout will not be rendered in the Blocks context. Should be used if the intention is to assign event listeners now but render the component later.'}}, 'postprocess': {}}, 'events': {}}, '__meta__': {'additional_interfaces': {}}}
7
+
8
+ abs_path = os.path.join(os.path.dirname(__file__), "css.css")
9
+
10
+ with gr.Blocks(
11
+ css=abs_path,
12
+ theme=gr.themes.Default(
13
+ font_mono=[
14
+ gr.themes.GoogleFont("Inconsolata"),
15
+ "monospace",
16
+ ],
17
+ ),
18
+ ) as demo:
19
+ gr.Markdown(
20
+ """
21
+ # `gradio_coolcanvas`
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
+ Python library for easily interacting with trained machine learning models
28
+ """, elem_classes=["md-custom"], header_links=True)
29
+ app.render()
30
+ gr.Markdown(
31
+ """
32
+ ## Installation
33
+
34
+ ```bash
35
+ pip install gradio_coolcanvas
36
+ ```
37
+
38
+ ## Usage
39
+
40
+ ```python
41
+
42
+ import gradio as gr
43
+ from gradio_coolcanvas import CoolCanvas
44
+
45
+
46
+ def greet(name):
47
+ return "Hello " + name + "!"
48
+
49
+ with gr.Blocks() as demo:
50
+ with CoolCanvas():
51
+ gr.Markdown("### This is a couple of elements without any gr.Group. Form elements naturally group together anyway.")
52
+ gr.Textbox("A")
53
+ gr.Number(3)
54
+ gr.Button()
55
+ gr.Image()
56
+ gr.Slider()
57
+
58
+ gr.Markdown("### This is the same set put in a gr.Group.")
59
+ with gr.Group():
60
+ gr.Textbox("A")
61
+ gr.Number(3)
62
+ gr.Button()
63
+ gr.Image()
64
+ gr.Slider()
65
+
66
+ gr.Markdown("### Now in a Row, no group.")
67
+ with gr.Row():
68
+ gr.Textbox("A")
69
+ gr.Number(3)
70
+ gr.Button()
71
+ gr.Image()
72
+ gr.Slider()
73
+
74
+ gr.Markdown("### Now in a Row in a group.")
75
+ with gr.Group():
76
+ with gr.Row():
77
+ gr.Textbox("A")
78
+ gr.Number(3)
79
+ gr.Button()
80
+ gr.Image()
81
+ gr.Slider()
82
+
83
+ gr.Markdown("### Several rows grouped together.")
84
+ with gr.Group():
85
+ with gr.Row():
86
+ gr.Textbox("A")
87
+ gr.Number(3)
88
+ gr.Button()
89
+ with gr.Row():
90
+ gr.Image()
91
+ gr.Audio()
92
+
93
+ gr.Markdown("### Several columns grouped together. If columns are uneven, there is a gray group background.")
94
+ with gr.Group():
95
+ with gr.Row():
96
+ with gr.Column():
97
+ name = gr.Textbox(label="Name")
98
+ btn = gr.Button("Hello")
99
+ gr.Dropdown(["a", "b", "c"], interactive=True)
100
+ gr.Number()
101
+ gr.Textbox()
102
+ with gr.Column():
103
+ gr.Image()
104
+ gr.Dropdown(["a", "b", "c"], interactive=True)
105
+ with gr.Row():
106
+ gr.Number(scale=2)
107
+ gr.Textbox()
108
+
109
+ gr.Markdown("### container=False removes label, padding, and block border, placing elements 'directly' on background.")
110
+ gr.Radio([1,2,3], container=False)
111
+ gr.Textbox(container=False)
112
+ gr.Image("https://picsum.photos/id/237/200/300", container=False, height=200)
113
+
114
+ gr.Markdown("### Textbox, Dropdown, and Number input boxes takes up full space when within a group without a container.")
115
+
116
+
117
+ with gr.Group():
118
+ name = gr.Textbox(label="Name")
119
+ output = gr.Textbox(show_label=False, container=False)
120
+ greet_btn = gr.Button("Greet")
121
+ with gr.Row():
122
+ gr.Dropdown(["a", "b", "c"], interactive=True, container=False)
123
+ gr.Textbox(container=False)
124
+ gr.Number(container=False)
125
+ gr.Image(height=100)
126
+ greet_btn.click(fn=greet, inputs=name, outputs=output, api_name="greet")
127
+
128
+
129
+ gr.Markdown("### More examples")
130
+
131
+ with gr.Group():
132
+ gr.Chatbot()
133
+ with gr.Row():
134
+ name = gr.Textbox(label="Prompot", container=False)
135
+ go = gr.Button("go", scale=0)
136
+
137
+ with gr.Column():
138
+ gr.Radio([1,2,3], container=False)
139
+ gr.Slider(0, 20, container=False)
140
+
141
+ with gr.Group():
142
+ with gr.Row():
143
+ gr.Dropdown(["a", "b", "c"], interactive=True, container=False, elem_id="here2")
144
+ gr.Number(container=False)
145
+ gr.Textbox(container=False)
146
+
147
+ with gr.Row():
148
+ with gr.Column():
149
+ gr.Dropdown(["a", "b", "c"], interactive=True, container=False, elem_id="here2")
150
+ with gr.Column():
151
+ gr.Number(container=False)
152
+ with gr.Column():
153
+ gr.Textbox(container=False)
154
+
155
+
156
+ if __name__ == "__main__":
157
+ demo.launch()
158
+ ```
159
+ """, elem_classes=["md-custom"], header_links=True)
160
+
161
+
162
+ gr.Markdown("""
163
+ ## `CoolCanvas`
164
+
165
+ ### Initialization
166
+ """, elem_classes=["md-custom"], header_links=True)
167
+
168
+ gr.ParamViewer(value=_docs["CoolCanvas"]["members"]["__init__"], linkify=[])
169
+
170
+
171
+
172
+
173
+
174
+
175
+
176
+ demo.load(None, js=r"""function() {
177
+ const refs = {};
178
+ const user_fn_refs = {};
179
+ requestAnimationFrame(() => {
180
+
181
+ Object.entries(user_fn_refs).forEach(([key, refs]) => {
182
+ if (refs.length > 0) {
183
+ const el = document.querySelector(`.${key}-user-fn`);
184
+ if (!el) return;
185
+ refs.forEach(ref => {
186
+ el.innerHTML = el.innerHTML.replace(
187
+ new RegExp("\\b"+ref+"\\b", "g"),
188
+ `<a href="#h-${ref.toLowerCase()}">${ref}</a>`
189
+ );
190
+ })
191
+ }
192
+ })
193
+
194
+ Object.entries(refs).forEach(([key, refs]) => {
195
+ if (refs.length > 0) {
196
+ const el = document.querySelector(`.${key}`);
197
+ if (!el) return;
198
+ refs.forEach(ref => {
199
+ el.innerHTML = el.innerHTML.replace(
200
+ new RegExp("\\b"+ref+"\\b", "g"),
201
+ `<a href="#h-${ref.toLowerCase()}">${ref}</a>`
202
+ );
203
+ })
204
+ }
205
+ })
206
+ })
207
+ }
208
+
209
+ """)
210
+
211
+ demo.launch()
src/frontend/Index.svelte ADDED
@@ -0,0 +1,111 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <script lang="ts">
2
+ import Moveable from "svelte-moveable";
3
+
4
+ export let elem_id = "";
5
+ export let elem_classes: string[] = [];
6
+ export let visible = true;
7
+
8
+ let data: HTMLDivElement;
9
+ let componentElements = [];
10
+
11
+ $: {
12
+ if (data) {
13
+ componentElements = Array.from(
14
+ data.querySelectorAll('[id^="component-"]')
15
+ );
16
+ }
17
+ }
18
+
19
+ const draggable = true;
20
+ const throttleDrag = 1;
21
+ const edgeDraggable = true;
22
+ const startDragRotate = 0;
23
+ const throttleDragRotate = 0;
24
+ const scalable = true;
25
+ const keepRatio = false;
26
+ const throttleScale = 0;
27
+ const renderDirections = ["nw", "n", "ne", "w", "e", "sw", "s", "se"];
28
+ const rotatable = true;
29
+ const throttleRotate = 0;
30
+ const rotationPosition = "top";
31
+
32
+ let editing = false;
33
+ </script>
34
+
35
+ <div
36
+ id={elem_id}
37
+ class="gr-group {elem_classes.join(' ')}"
38
+ class:hide={!visible}
39
+ >
40
+ <button class="edit-button" on:click={() => (editing = !editing)}
41
+ >{editing ? "Done" : "Edit"}</button
42
+ >
43
+ <div bind:this={data} class="hide">
44
+ <slot />
45
+ </div>
46
+
47
+ {#each componentElements as elmt, id}
48
+ <div class={"target target" + id}>
49
+ {@html elmt.outerHTML}
50
+ </div>
51
+ {/each}
52
+
53
+ {#if componentElements.length > 0 && editing}
54
+ <Moveable
55
+ target={".target"}
56
+ individualGroupable={true}
57
+ {draggable}
58
+ {throttleDrag}
59
+ {edgeDraggable}
60
+ {startDragRotate}
61
+ {throttleDragRotate}
62
+ {scalable}
63
+ {keepRatio}
64
+ {throttleScale}
65
+ {renderDirections}
66
+ {rotatable}
67
+ {throttleRotate}
68
+ {rotationPosition}
69
+ on:drag={({ detail: e }) => {
70
+ e.target.style.transform = e.transform;
71
+ }}
72
+ on:scale={({ detail: e }) => {
73
+ e.target.style.transform = e.drag.transform;
74
+ }}
75
+ on:rotate={({ detail: e }) => {
76
+ e.target.style.transform = e.drag.transform;
77
+ }}
78
+ />
79
+ {/if}
80
+ </div>
81
+
82
+ <style>
83
+ .edit-button {
84
+ position: absolute;
85
+ top: 0;
86
+ right: 0;
87
+ left: 100%;
88
+ }
89
+
90
+ :global(.moveable-line) {
91
+ opacity: 0.1;
92
+ }
93
+
94
+ :global(.moveable-control) {
95
+ opacity: 0.2;
96
+ }
97
+
98
+ :global(.moveable-origin) {
99
+ opacity: 0;
100
+ }
101
+ :global(.gradio-container) {
102
+ overflow: visible;
103
+ }
104
+ .hide {
105
+ display: none;
106
+ }
107
+
108
+ .target {
109
+ margin: 30px;
110
+ }
111
+ </style>
src/frontend/package-lock.json ADDED
@@ -0,0 +1,472 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "gradio_coolcanvas",
3
+ "version": "0.1.0",
4
+ "lockfileVersion": 3,
5
+ "requires": true,
6
+ "packages": {
7
+ "": {
8
+ "name": "gradio_coolcanvas",
9
+ "version": "0.1.0",
10
+ "license": "ISC",
11
+ "dependencies": {
12
+ "svelte-moveable": "^0.45.0"
13
+ }
14
+ },
15
+ "node_modules/@ampproject/remapping": {
16
+ "version": "2.2.1",
17
+ "resolved": "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.2.1.tgz",
18
+ "integrity": "sha512-lFMjJTrFL3j7L9yBxwYfCq2k6qqwHyzuUl/XBnif78PWTJYyL/dfowQHWE3sp6U6ZzqWiiIZnpTMO96zhkjwtg==",
19
+ "peer": true,
20
+ "dependencies": {
21
+ "@jridgewell/gen-mapping": "^0.3.0",
22
+ "@jridgewell/trace-mapping": "^0.3.9"
23
+ },
24
+ "engines": {
25
+ "node": ">=6.0.0"
26
+ }
27
+ },
28
+ "node_modules/@cfcs/core": {
29
+ "version": "0.0.6",
30
+ "resolved": "https://registry.npmjs.org/@cfcs/core/-/core-0.0.6.tgz",
31
+ "integrity": "sha512-FxfJMwoLB8MEMConeXUCqtMGqxdtePQxRBOiGip9ULcYYam3WfCgoY6xdnMaSkYvRvmosp5iuG+TiPofm65+Pw==",
32
+ "dependencies": {
33
+ "@egjs/component": "^3.0.2"
34
+ }
35
+ },
36
+ "node_modules/@daybrush/utils": {
37
+ "version": "1.13.0",
38
+ "resolved": "https://registry.npmjs.org/@daybrush/utils/-/utils-1.13.0.tgz",
39
+ "integrity": "sha512-ALK12C6SQNNHw1enXK+UO8bdyQ+jaWNQ1Af7Z3FNxeAwjYhQT7do+TRE4RASAJ3ObaS2+TJ7TXR3oz2Gzbw0PQ=="
40
+ },
41
+ "node_modules/@egjs/agent": {
42
+ "version": "2.4.3",
43
+ "resolved": "https://registry.npmjs.org/@egjs/agent/-/agent-2.4.3.tgz",
44
+ "integrity": "sha512-XvksSENe8wPeFlEVouvrOhKdx8HMniJ3by7sro2uPF3M6QqWwjzVcmvwoPtdjiX8O1lfRoLhQMp1a7NGlVTdIA=="
45
+ },
46
+ "node_modules/@egjs/children-differ": {
47
+ "version": "1.0.1",
48
+ "resolved": "https://registry.npmjs.org/@egjs/children-differ/-/children-differ-1.0.1.tgz",
49
+ "integrity": "sha512-DRvyqMf+CPCOzAopQKHtW+X8iN6Hy6SFol+/7zCUiE5y4P/OB8JP8FtU4NxtZwtafvSL4faD5KoQYPj3JHzPFQ==",
50
+ "dependencies": {
51
+ "@egjs/list-differ": "^1.0.0"
52
+ }
53
+ },
54
+ "node_modules/@egjs/component": {
55
+ "version": "3.0.5",
56
+ "resolved": "https://registry.npmjs.org/@egjs/component/-/component-3.0.5.tgz",
57
+ "integrity": "sha512-cLcGizTrrUNA2EYE3MBmEDt2tQv1joVP1Q3oDisZ5nw0MZDx2kcgEXM+/kZpfa/PAkFvYVhRUZwytIQWoN3V/w=="
58
+ },
59
+ "node_modules/@egjs/list-differ": {
60
+ "version": "1.0.1",
61
+ "resolved": "https://registry.npmjs.org/@egjs/list-differ/-/list-differ-1.0.1.tgz",
62
+ "integrity": "sha512-OTFTDQcWS+1ZREOdCWuk5hCBgYO4OsD30lXcOCyVOAjXMhgL5rBRDnt/otb6Nz8CzU0L/igdcaQBDLWc4t9gvg=="
63
+ },
64
+ "node_modules/@jridgewell/gen-mapping": {
65
+ "version": "0.3.3",
66
+ "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.3.tgz",
67
+ "integrity": "sha512-HLhSWOLRi875zjjMG/r+Nv0oCW8umGb0BgEhyX3dDX3egwZtB8PqLnjz3yedt8R5StBrzcg4aBpnh8UA9D1BoQ==",
68
+ "peer": true,
69
+ "dependencies": {
70
+ "@jridgewell/set-array": "^1.0.1",
71
+ "@jridgewell/sourcemap-codec": "^1.4.10",
72
+ "@jridgewell/trace-mapping": "^0.3.9"
73
+ },
74
+ "engines": {
75
+ "node": ">=6.0.0"
76
+ }
77
+ },
78
+ "node_modules/@jridgewell/resolve-uri": {
79
+ "version": "3.1.1",
80
+ "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.1.tgz",
81
+ "integrity": "sha512-dSYZh7HhCDtCKm4QakX0xFpsRDqjjtZf/kjI/v3T3Nwt5r8/qz/M19F9ySyOqU94SXBmeG9ttTul+YnR4LOxFA==",
82
+ "peer": true,
83
+ "engines": {
84
+ "node": ">=6.0.0"
85
+ }
86
+ },
87
+ "node_modules/@jridgewell/set-array": {
88
+ "version": "1.1.2",
89
+ "resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.1.2.tgz",
90
+ "integrity": "sha512-xnkseuNADM0gt2bs+BvhO0p78Mk762YnZdsuzFV018NoG1Sj1SCQvpSqa7XUaTam5vAGasABV9qXASMKnFMwMw==",
91
+ "peer": true,
92
+ "engines": {
93
+ "node": ">=6.0.0"
94
+ }
95
+ },
96
+ "node_modules/@jridgewell/sourcemap-codec": {
97
+ "version": "1.4.15",
98
+ "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz",
99
+ "integrity": "sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==",
100
+ "peer": true
101
+ },
102
+ "node_modules/@jridgewell/trace-mapping": {
103
+ "version": "0.3.22",
104
+ "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.22.tgz",
105
+ "integrity": "sha512-Wf963MzWtA2sjrNt+g18IAln9lKnlRp+K2eH4jjIoF1wYeq3aMREpG09xhlhdzS0EjwU7qmUJYangWa+151vZw==",
106
+ "peer": true,
107
+ "dependencies": {
108
+ "@jridgewell/resolve-uri": "^3.1.0",
109
+ "@jridgewell/sourcemap-codec": "^1.4.14"
110
+ }
111
+ },
112
+ "node_modules/@scena/dragscroll": {
113
+ "version": "1.4.0",
114
+ "resolved": "https://registry.npmjs.org/@scena/dragscroll/-/dragscroll-1.4.0.tgz",
115
+ "integrity": "sha512-3O8daaZD9VXA9CP3dra6xcgt/qrm0mg0xJCwiX6druCteQ9FFsXffkF8PrqxY4Z4VJ58fFKEa0RlKqbsi/XnRA==",
116
+ "dependencies": {
117
+ "@daybrush/utils": "^1.6.0",
118
+ "@scena/event-emitter": "^1.0.2"
119
+ }
120
+ },
121
+ "node_modules/@scena/event-emitter": {
122
+ "version": "1.0.5",
123
+ "resolved": "https://registry.npmjs.org/@scena/event-emitter/-/event-emitter-1.0.5.tgz",
124
+ "integrity": "sha512-AzY4OTb0+7ynefmWFQ6hxDdk0CySAq/D4efljfhtRHCOP7MBF9zUfhKG3TJiroVjASqVgkRJFdenS8ArZo6Olg==",
125
+ "dependencies": {
126
+ "@daybrush/utils": "^1.1.1"
127
+ }
128
+ },
129
+ "node_modules/@scena/matrix": {
130
+ "version": "1.1.1",
131
+ "resolved": "https://registry.npmjs.org/@scena/matrix/-/matrix-1.1.1.tgz",
132
+ "integrity": "sha512-JVKBhN0tm2Srl+Yt+Ywqu0oLgLcdemDQlD1OxmN9jaCTwaFPZ7tY8n6dhVgMEaR9qcR7r+kAlMXnSfNyYdE+Vg==",
133
+ "dependencies": {
134
+ "@daybrush/utils": "^1.4.0"
135
+ }
136
+ },
137
+ "node_modules/@types/estree": {
138
+ "version": "1.0.5",
139
+ "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.5.tgz",
140
+ "integrity": "sha512-/kYRxGDLWzHOB7q+wtSUQlFrtcdUccpfy+X+9iMBpHK8QLLhx2wIPYuS5DYtR9Wa/YlZAbIovy7qVdB1Aq6Lyw==",
141
+ "peer": true
142
+ },
143
+ "node_modules/acorn": {
144
+ "version": "8.11.3",
145
+ "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.11.3.tgz",
146
+ "integrity": "sha512-Y9rRfJG5jcKOE0CLisYbojUjIrIEE7AGMzA/Sm4BslANhbS+cDMpgBdcPT91oJ7OuJ9hYJBx59RjbhxVnrF8Xg==",
147
+ "peer": true,
148
+ "bin": {
149
+ "acorn": "bin/acorn"
150
+ },
151
+ "engines": {
152
+ "node": ">=0.4.0"
153
+ }
154
+ },
155
+ "node_modules/aria-query": {
156
+ "version": "5.3.0",
157
+ "resolved": "https://registry.npmjs.org/aria-query/-/aria-query-5.3.0.tgz",
158
+ "integrity": "sha512-b0P0sZPKtyu8HkeRAfCq0IfURZK+SuwMjY1UXGBU27wpAiTwQAIlq56IbIO+ytk/JjS1fMR14ee5WBBfKi5J6A==",
159
+ "peer": true,
160
+ "dependencies": {
161
+ "dequal": "^2.0.3"
162
+ }
163
+ },
164
+ "node_modules/axobject-query": {
165
+ "version": "4.0.0",
166
+ "resolved": "https://registry.npmjs.org/axobject-query/-/axobject-query-4.0.0.tgz",
167
+ "integrity": "sha512-+60uv1hiVFhHZeO+Lz0RYzsVHy5Wr1ayX0mwda9KPDVLNJgZ1T9Ny7VmFbLDzxsH0D87I86vgj3gFrjTJUYznw==",
168
+ "peer": true,
169
+ "dependencies": {
170
+ "dequal": "^2.0.3"
171
+ }
172
+ },
173
+ "node_modules/code-red": {
174
+ "version": "1.0.4",
175
+ "resolved": "https://registry.npmjs.org/code-red/-/code-red-1.0.4.tgz",
176
+ "integrity": "sha512-7qJWqItLA8/VPVlKJlFXU+NBlo/qyfs39aJcuMT/2ere32ZqvF5OSxgdM5xOfJJ7O429gg2HM47y8v9P+9wrNw==",
177
+ "peer": true,
178
+ "dependencies": {
179
+ "@jridgewell/sourcemap-codec": "^1.4.15",
180
+ "@types/estree": "^1.0.1",
181
+ "acorn": "^8.10.0",
182
+ "estree-walker": "^3.0.3",
183
+ "periscopic": "^3.1.0"
184
+ }
185
+ },
186
+ "node_modules/croact": {
187
+ "version": "1.0.4",
188
+ "resolved": "https://registry.npmjs.org/croact/-/croact-1.0.4.tgz",
189
+ "integrity": "sha512-9GhvyzTY/IVUrMQ2iz/mzgZ8+NcjczmIo/t4FkC1CU0CEcau6v6VsEih4jkTa4ZmRgYTF0qXEZLObCzdDFplpw==",
190
+ "dependencies": {
191
+ "@daybrush/utils": "^1.13.0",
192
+ "@egjs/list-differ": "^1.0.0"
193
+ }
194
+ },
195
+ "node_modules/croact-css-styled": {
196
+ "version": "1.1.9",
197
+ "resolved": "https://registry.npmjs.org/croact-css-styled/-/croact-css-styled-1.1.9.tgz",
198
+ "integrity": "sha512-G7yvRiVJ3Eoj0ov2h2xR4312hpOzATay2dGS9clK8yJQothjH1sBXIyvOeRP5wBKD9mPcKcoUXPCPsl0tQog4w==",
199
+ "dependencies": {
200
+ "@daybrush/utils": "^1.13.0",
201
+ "css-styled": "~1.0.8",
202
+ "framework-utils": "^1.1.0"
203
+ }
204
+ },
205
+ "node_modules/croact-moveable": {
206
+ "version": "0.9.0",
207
+ "resolved": "https://registry.npmjs.org/croact-moveable/-/croact-moveable-0.9.0.tgz",
208
+ "integrity": "sha512-fc3bieV6CdqqZFtzsSLi9KmvUMFW3oakUfhPCls1BxKjOfUfn8rktteGED2341A/Qghy8tI3Hm6SdocIc68IKg==",
209
+ "dependencies": {
210
+ "@daybrush/utils": "^1.13.0",
211
+ "@egjs/agent": "^2.2.1",
212
+ "@egjs/children-differ": "^1.0.1",
213
+ "@egjs/list-differ": "^1.0.0",
214
+ "@scena/dragscroll": "^1.4.0",
215
+ "@scena/event-emitter": "^1.0.5",
216
+ "@scena/matrix": "^1.1.1",
217
+ "croact-css-styled": "^1.1.9",
218
+ "css-to-mat": "^1.1.1",
219
+ "framework-utils": "^1.1.0",
220
+ "gesto": "^1.19.3",
221
+ "overlap-area": "^1.1.0",
222
+ "react-css-styled": "^1.1.9",
223
+ "react-moveable": "~0.56.0"
224
+ },
225
+ "peerDependencies": {
226
+ "croact": "^1.0.4"
227
+ }
228
+ },
229
+ "node_modules/css-styled": {
230
+ "version": "1.0.8",
231
+ "resolved": "https://registry.npmjs.org/css-styled/-/css-styled-1.0.8.tgz",
232
+ "integrity": "sha512-tCpP7kLRI8dI95rCh3Syl7I+v7PP+2JYOzWkl0bUEoSbJM+u8ITbutjlQVf0NC2/g4ULROJPi16sfwDIO8/84g==",
233
+ "dependencies": {
234
+ "@daybrush/utils": "^1.13.0"
235
+ }
236
+ },
237
+ "node_modules/css-to-mat": {
238
+ "version": "1.1.1",
239
+ "resolved": "https://registry.npmjs.org/css-to-mat/-/css-to-mat-1.1.1.tgz",
240
+ "integrity": "sha512-kvpxFYZb27jRd2vium35G7q5XZ2WJ9rWjDUMNT36M3Hc41qCrLXFM5iEKMGXcrPsKfXEN+8l/riB4QzwwwiEyQ==",
241
+ "dependencies": {
242
+ "@daybrush/utils": "^1.13.0",
243
+ "@scena/matrix": "^1.0.0"
244
+ }
245
+ },
246
+ "node_modules/css-tree": {
247
+ "version": "2.3.1",
248
+ "resolved": "https://registry.npmjs.org/css-tree/-/css-tree-2.3.1.tgz",
249
+ "integrity": "sha512-6Fv1DV/TYw//QF5IzQdqsNDjx/wc8TrMBZsqjL9eW01tWb7R7k/mq+/VXfJCl7SoD5emsJop9cOByJZfs8hYIw==",
250
+ "peer": true,
251
+ "dependencies": {
252
+ "mdn-data": "2.0.30",
253
+ "source-map-js": "^1.0.1"
254
+ },
255
+ "engines": {
256
+ "node": "^10 || ^12.20.0 || ^14.13.0 || >=15.0.0"
257
+ }
258
+ },
259
+ "node_modules/dequal": {
260
+ "version": "2.0.3",
261
+ "resolved": "https://registry.npmjs.org/dequal/-/dequal-2.0.3.tgz",
262
+ "integrity": "sha512-0je+qPKHEMohvfRTCEo3CrPG6cAzAYgmzKyxRiYSSDkS6eGJdyVJm7WaYA5ECaAD9wLB2T4EEeymA5aFVcYXCA==",
263
+ "peer": true,
264
+ "engines": {
265
+ "node": ">=6"
266
+ }
267
+ },
268
+ "node_modules/estree-walker": {
269
+ "version": "3.0.3",
270
+ "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-3.0.3.tgz",
271
+ "integrity": "sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g==",
272
+ "peer": true,
273
+ "dependencies": {
274
+ "@types/estree": "^1.0.0"
275
+ }
276
+ },
277
+ "node_modules/framework-utils": {
278
+ "version": "1.1.0",
279
+ "resolved": "https://registry.npmjs.org/framework-utils/-/framework-utils-1.1.0.tgz",
280
+ "integrity": "sha512-KAfqli5PwpFJ8o3psRNs8svpMGyCSAe8nmGcjQ0zZBWN2H6dZDnq+ABp3N3hdUmFeMrLtjOCTXD4yplUJIWceg=="
281
+ },
282
+ "node_modules/gesto": {
283
+ "version": "1.19.4",
284
+ "resolved": "https://registry.npmjs.org/gesto/-/gesto-1.19.4.tgz",
285
+ "integrity": "sha512-hfr/0dWwh0Bnbb88s3QVJd1ZRJeOWcgHPPwmiH6NnafDYvhTsxg+SLYu+q/oPNh9JS3V+nlr6fNs8kvPAtcRDQ==",
286
+ "dependencies": {
287
+ "@daybrush/utils": "^1.13.0",
288
+ "@scena/event-emitter": "^1.0.2"
289
+ }
290
+ },
291
+ "node_modules/is-reference": {
292
+ "version": "3.0.2",
293
+ "resolved": "https://registry.npmjs.org/is-reference/-/is-reference-3.0.2.tgz",
294
+ "integrity": "sha512-v3rht/LgVcsdZa3O2Nqs+NMowLOxeOm7Ay9+/ARQ2F+qEoANRcqrjAZKGN0v8ymUetZGgkp26LTnGT7H0Qo9Pg==",
295
+ "peer": true,
296
+ "dependencies": {
297
+ "@types/estree": "*"
298
+ }
299
+ },
300
+ "node_modules/keycode": {
301
+ "version": "2.2.1",
302
+ "resolved": "https://registry.npmjs.org/keycode/-/keycode-2.2.1.tgz",
303
+ "integrity": "sha512-Rdgz9Hl9Iv4QKi8b0OlCRQEzp4AgVxyCtz5S/+VIHezDmrDhkp2N2TqBWOLz0/gbeREXOOiI9/4b8BY9uw2vFg=="
304
+ },
305
+ "node_modules/keycon": {
306
+ "version": "1.4.0",
307
+ "resolved": "https://registry.npmjs.org/keycon/-/keycon-1.4.0.tgz",
308
+ "integrity": "sha512-p1NAIxiRMH3jYfTeXRs2uWbVJ1WpEjpi8ktzUyBJsX7/wn2qu2VRXktneBLNtKNxJmlUYxRi9gOJt1DuthXR7A==",
309
+ "dependencies": {
310
+ "@cfcs/core": "^0.0.6",
311
+ "@daybrush/utils": "^1.7.1",
312
+ "@scena/event-emitter": "^1.0.2",
313
+ "keycode": "^2.2.0"
314
+ }
315
+ },
316
+ "node_modules/locate-character": {
317
+ "version": "3.0.0",
318
+ "resolved": "https://registry.npmjs.org/locate-character/-/locate-character-3.0.0.tgz",
319
+ "integrity": "sha512-SW13ws7BjaeJ6p7Q6CO2nchbYEc3X3J6WrmTTDto7yMPqVSZTUyY5Tjbid+Ab8gLnATtygYtiDIJGQRRn2ZOiA==",
320
+ "peer": true
321
+ },
322
+ "node_modules/magic-string": {
323
+ "version": "0.30.6",
324
+ "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.6.tgz",
325
+ "integrity": "sha512-n62qCLbPjNjyo+owKtveQxZFZTBm+Ms6YoGD23Wew6Vw337PElFNifQpknPruVRQV57kVShPnLGo9vWxVhpPvA==",
326
+ "peer": true,
327
+ "dependencies": {
328
+ "@jridgewell/sourcemap-codec": "^1.4.15"
329
+ },
330
+ "engines": {
331
+ "node": ">=12"
332
+ }
333
+ },
334
+ "node_modules/mdn-data": {
335
+ "version": "2.0.30",
336
+ "resolved": "https://registry.npmjs.org/mdn-data/-/mdn-data-2.0.30.tgz",
337
+ "integrity": "sha512-GaqWWShW4kv/G9IEucWScBx9G1/vsFZZJUO+tD26M8J8z3Kw5RDQjaoZe03YAClgeS/SWPOcb4nkFBTEi5DUEA==",
338
+ "peer": true
339
+ },
340
+ "node_modules/moveable": {
341
+ "version": "0.53.0",
342
+ "resolved": "https://registry.npmjs.org/moveable/-/moveable-0.53.0.tgz",
343
+ "integrity": "sha512-71jS9zIoQzMhnNvduhg4tUEdm23+fO/40FN7muVMbZvVwbTku2MIxxLhnU4qFvxI4oVxn75l79SbtgjuA+s7Pw==",
344
+ "dependencies": {
345
+ "@daybrush/utils": "^1.13.0",
346
+ "@scena/event-emitter": "^1.0.5",
347
+ "croact": "^1.0.4",
348
+ "croact-moveable": "~0.9.0",
349
+ "react-moveable": "~0.56.0"
350
+ }
351
+ },
352
+ "node_modules/overlap-area": {
353
+ "version": "1.1.0",
354
+ "resolved": "https://registry.npmjs.org/overlap-area/-/overlap-area-1.1.0.tgz",
355
+ "integrity": "sha512-3dlJgJCaVeXH0/eZjYVJvQiLVVrPO4U1ZGqlATtx6QGO3b5eNM6+JgUKa7oStBTdYuGTk7gVoABCW6Tp+dhRdw==",
356
+ "dependencies": {
357
+ "@daybrush/utils": "^1.7.1"
358
+ }
359
+ },
360
+ "node_modules/periscopic": {
361
+ "version": "3.1.0",
362
+ "resolved": "https://registry.npmjs.org/periscopic/-/periscopic-3.1.0.tgz",
363
+ "integrity": "sha512-vKiQ8RRtkl9P+r/+oefh25C3fhybptkHKCZSPlcXiJux2tJF55GnEj3BVn4A5gKfq9NWWXXrxkHBwVPUfH0opw==",
364
+ "peer": true,
365
+ "dependencies": {
366
+ "@types/estree": "^1.0.0",
367
+ "estree-walker": "^3.0.0",
368
+ "is-reference": "^3.0.0"
369
+ }
370
+ },
371
+ "node_modules/react-css-styled": {
372
+ "version": "1.1.9",
373
+ "resolved": "https://registry.npmjs.org/react-css-styled/-/react-css-styled-1.1.9.tgz",
374
+ "integrity": "sha512-M7fJZ3IWFaIHcZEkoFOnkjdiUFmwd8d+gTh2bpqMOcnxy/0Gsykw4dsL4QBiKsxcGow6tETUa4NAUcmJF+/nfw==",
375
+ "dependencies": {
376
+ "css-styled": "~1.0.8",
377
+ "framework-utils": "^1.1.0"
378
+ }
379
+ },
380
+ "node_modules/react-moveable": {
381
+ "version": "0.56.0",
382
+ "resolved": "https://registry.npmjs.org/react-moveable/-/react-moveable-0.56.0.tgz",
383
+ "integrity": "sha512-FmJNmIOsOA36mdxbrc/huiE4wuXSRlmon/o+/OrfNhSiYYYL0AV5oObtPluEhb2Yr/7EfYWBHTxF5aWAvjg1SA==",
384
+ "dependencies": {
385
+ "@daybrush/utils": "^1.13.0",
386
+ "@egjs/agent": "^2.2.1",
387
+ "@egjs/children-differ": "^1.0.1",
388
+ "@egjs/list-differ": "^1.0.0",
389
+ "@scena/dragscroll": "^1.4.0",
390
+ "@scena/event-emitter": "^1.0.5",
391
+ "@scena/matrix": "^1.1.1",
392
+ "css-to-mat": "^1.1.1",
393
+ "framework-utils": "^1.1.0",
394
+ "gesto": "^1.19.3",
395
+ "overlap-area": "^1.1.0",
396
+ "react-css-styled": "^1.1.9",
397
+ "react-selecto": "^1.25.0"
398
+ }
399
+ },
400
+ "node_modules/react-selecto": {
401
+ "version": "1.26.3",
402
+ "resolved": "https://registry.npmjs.org/react-selecto/-/react-selecto-1.26.3.tgz",
403
+ "integrity": "sha512-Ubik7kWSnZyQEBNro+1k38hZaI1tJarE+5aD/qsqCOA1uUBSjgKVBy3EWRzGIbdmVex7DcxznFZLec/6KZNvwQ==",
404
+ "dependencies": {
405
+ "selecto": "~1.26.3"
406
+ }
407
+ },
408
+ "node_modules/selecto": {
409
+ "version": "1.26.3",
410
+ "resolved": "https://registry.npmjs.org/selecto/-/selecto-1.26.3.tgz",
411
+ "integrity": "sha512-gZHgqMy5uyB6/2YDjv3Qqaf7bd2hTDOpPdxXlrez4R3/L0GiEWDCFaUfrflomgqdb3SxHF2IXY0Jw0EamZi7cw==",
412
+ "dependencies": {
413
+ "@daybrush/utils": "^1.13.0",
414
+ "@egjs/children-differ": "^1.0.1",
415
+ "@scena/dragscroll": "^1.4.0",
416
+ "@scena/event-emitter": "^1.0.5",
417
+ "css-styled": "^1.0.8",
418
+ "css-to-mat": "^1.1.1",
419
+ "framework-utils": "^1.1.0",
420
+ "gesto": "^1.19.4",
421
+ "keycon": "^1.2.0",
422
+ "overlap-area": "^1.1.0"
423
+ }
424
+ },
425
+ "node_modules/source-map-js": {
426
+ "version": "1.0.2",
427
+ "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.0.2.tgz",
428
+ "integrity": "sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw==",
429
+ "peer": true,
430
+ "engines": {
431
+ "node": ">=0.10.0"
432
+ }
433
+ },
434
+ "node_modules/svelte": {
435
+ "version": "4.2.9",
436
+ "resolved": "https://registry.npmjs.org/svelte/-/svelte-4.2.9.tgz",
437
+ "integrity": "sha512-hsoB/WZGEPFXeRRLPhPrbRz67PhP6sqYgvwcAs+gWdSQSvNDw+/lTeUJSWe5h2xC97Fz/8QxAOqItwBzNJPU8w==",
438
+ "peer": true,
439
+ "dependencies": {
440
+ "@ampproject/remapping": "^2.2.1",
441
+ "@jridgewell/sourcemap-codec": "^1.4.15",
442
+ "@jridgewell/trace-mapping": "^0.3.18",
443
+ "@types/estree": "^1.0.1",
444
+ "acorn": "^8.9.0",
445
+ "aria-query": "^5.3.0",
446
+ "axobject-query": "^4.0.0",
447
+ "code-red": "^1.0.3",
448
+ "css-tree": "^2.3.1",
449
+ "estree-walker": "^3.0.3",
450
+ "is-reference": "^3.0.1",
451
+ "locate-character": "^3.0.0",
452
+ "magic-string": "^0.30.4",
453
+ "periscopic": "^3.1.0"
454
+ },
455
+ "engines": {
456
+ "node": ">=16"
457
+ }
458
+ },
459
+ "node_modules/svelte-moveable": {
460
+ "version": "0.45.0",
461
+ "resolved": "https://registry.npmjs.org/svelte-moveable/-/svelte-moveable-0.45.0.tgz",
462
+ "integrity": "sha512-1zGk11Dhq2IJMS7c0Y0BK5Km4a1B0pzHHC3wKoecByHYcoyPI/lzabdC32YjyH1SyTN5HGmQUNFEB7WiADvJ7Q==",
463
+ "dependencies": {
464
+ "framework-utils": "^1.1.0",
465
+ "moveable": "~0.53.0"
466
+ },
467
+ "peerDependencies": {
468
+ "svelte": "^3.54.0 || ^4.0.0"
469
+ }
470
+ }
471
+ }
472
+ }
src/frontend/package.json ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "gradio_coolcanvas",
3
+ "version": "0.1.0",
4
+ "description": "Gradio UI packages",
5
+ "type": "module",
6
+ "author": "",
7
+ "license": "ISC",
8
+ "private": false,
9
+ "main_changeset": true,
10
+ "exports": {
11
+ ".": "./Index.svelte",
12
+ "./package.json": "./package.json"
13
+ },
14
+ "dependencies": {
15
+ "svelte-moveable": "^0.45.0"
16
+ }
17
+ }
src/pyproject.toml ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [build-system]
2
+ requires = [
3
+ "hatchling",
4
+ "hatch-requirements-txt",
5
+ "hatch-fancy-pypi-readme>=22.5.0",
6
+ ]
7
+ build-backend = "hatchling.build"
8
+
9
+ [project]
10
+ name = "gradio_coolcanvas"
11
+ version = "0.0.1"
12
+ description = "Python library for easily interacting with trained machine learning models"
13
+ readme = "README.md"
14
+ license = "Apache-2.0"
15
+ requires-python = ">=3.8"
16
+ authors = [{ name = "YOUR NAME", email = "YOUREMAIL@domain.com" }]
17
+ keywords = [
18
+ "gradio-custom-component",
19
+ "gradio-template-Group"
20
+ ]
21
+ # Add dependencies here
22
+ dependencies = ["gradio>=4.0,<5.0"]
23
+ classifiers = [
24
+ 'Development Status :: 3 - Alpha',
25
+ 'License :: OSI Approved :: Apache Software License',
26
+ 'Operating System :: OS Independent',
27
+ 'Programming Language :: Python :: 3',
28
+ 'Programming Language :: Python :: 3 :: Only',
29
+ 'Programming Language :: Python :: 3.8',
30
+ 'Programming Language :: Python :: 3.9',
31
+ 'Programming Language :: Python :: 3.10',
32
+ 'Programming Language :: Python :: 3.11',
33
+ 'Topic :: Scientific/Engineering',
34
+ 'Topic :: Scientific/Engineering :: Artificial Intelligence',
35
+ 'Topic :: Scientific/Engineering :: Visualization',
36
+ ]
37
+
38
+ [project.optional-dependencies]
39
+ dev = ["build", "twine"]
40
+
41
+ [tool.hatch.build]
42
+ artifacts = ["/backend/gradio_coolcanvas/templates", "*.pyi", "backend/gradio_coolcanvas/templates"]
43
+
44
+ [tool.hatch.build.targets.wheel]
45
+ packages = ["/backend/gradio_coolcanvas"]