radames commited on
Commit
cf6bfde
1 Parent(s): ceb78cd

Upload folder using huggingface_hub

Browse files
.gitattributes CHANGED
@@ -38,3 +38,4 @@ src/examples/rgbd.rrd filter=lfs diff=lfs merge=lfs -text
38
  src/examples/rrt-star.rrd filter=lfs diff=lfs merge=lfs -text
39
  src/examples/structure_from_motion.rrd filter=lfs diff=lfs merge=lfs -text
40
  *.rrd filter=lfs diff=lfs merge=lfs -text
 
 
38
  src/examples/rrt-star.rrd filter=lfs diff=lfs merge=lfs -text
39
  src/examples/structure_from_motion.rrd filter=lfs diff=lfs merge=lfs -text
40
  *.rrd filter=lfs diff=lfs merge=lfs -text
41
+ src/backend/gradio_rerun/templates/component/re_viewer-DOCTrs8v.js filter=lfs diff=lfs merge=lfs -text
.gitignore CHANGED
@@ -10,5 +10,4 @@ __tmp/*
10
  .ruff_cache
11
  node_modules
12
  backend/**/templates/
13
- venv
14
- .DS_Store
 
10
  .ruff_cache
11
  node_modules
12
  backend/**/templates/
13
+ venv
 
README.md CHANGED
@@ -1,26 +1,16 @@
1
  ---
2
- tags:
3
- [
4
- gradio-custom-component,
5
- SimpleImage,
6
- multimodal data,
7
- visualization,
8
- machine learning,
9
- robotics,
10
- ]
11
  title: gradio_rerun
12
  short_description: Rerun viewer with Gradio
13
  colorFrom: blue
14
  colorTo: yellow
15
  sdk: gradio
16
- sdk_version: 4.28.3
17
  pinned: false
18
  app_file: space.py
19
  ---
20
 
21
  # `gradio_rerun`
22
-
23
- <img alt="Static Badge" src="https://img.shields.io/badge/version%20-%200.0.1%20-%20orange"> <a href="https://github.com/radames/gradio-rerun-viewer/issues" target="_blank"><img alt="Static Badge" src="https://img.shields.io/badge/Issues-white?logo=github&logoColor=black"></a>
24
 
25
  Rerun viewer with Gradio
26
 
@@ -33,68 +23,154 @@ pip install gradio_rerun
33
  ## Usage
34
 
35
  ```python
 
 
 
 
 
36
  import gradio as gr
37
  from gradio_rerun import Rerun
38
 
 
 
39
 
40
- example = Rerun().example_value()
41
 
 
 
 
42
 
43
- def predict(url: str, file_path: str | list[str] | None):
44
- if url:
45
- return url
46
- return file_path
47
 
 
 
 
 
 
 
 
 
48
 
49
- with gr.Blocks(css=".gradio-container { max-width: unset!important; }") as demo:
50
- with gr.Row():
51
- with gr.Column():
52
- with gr.Group():
53
- file_path = gr.File(file_count="multiple", type="filepath")
54
- url = gr.Text(
55
- info="Or use a URL",
56
- label="URL",
57
- )
58
- with gr.Column():
59
- pass
60
- btn = gr.Button("Run", scale=0)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
61
  with gr.Row():
62
- rerun_viewer = Rerun(height=900)
63
-
64
- inputs = [file_path, url]
65
- outputs = [rerun_viewer]
66
-
67
- gr.on([btn.click, file_path.upload], fn=predict, inputs=inputs, outputs=outputs)
68
-
69
- gr.Examples(
70
- examples=[
71
- [
72
- None,
73
- "https://app.rerun.io/version/0.15.1/examples/detect_and_track_objects.rrd",
74
- ],
75
- [
76
- ["./examples/rgbd.rrd"],
77
- None,
78
- ],
79
- [
80
- ["./examples/rrt-star.rrd"],
81
- None,
82
- ],
83
- [
84
- ["./examples/structure_from_motion.rrd"],
85
- None,
86
- ],
87
- [
88
- ["./examples/structure_from_motion.rrd", "./examples/rrt-star.rrd"],
89
- None,
90
- ],
91
- ],
92
- fn=predict,
93
- inputs=inputs,
94
- outputs=outputs,
95
- run_on_click=True,
96
  )
97
 
 
 
 
98
  if __name__ == "__main__":
99
  demo.launch()
100
 
@@ -119,12 +195,17 @@ if __name__ == "__main__":
119
  <td align="left" style="width: 25%;">
120
 
121
  ```python
122
- list[str] | None
 
 
 
 
 
123
  ```
124
 
125
  </td>
126
  <td align="left"><code>None</code></td>
127
- <td align="left">A path or URL for the default value that Rerun component is going to take. If callable, the function will be called whenever the app loads to set the initial value of the component.</td>
128
  </tr>
129
 
130
  <tr>
@@ -166,19 +247,6 @@ bool | None
166
  <td align="left">if True, will display label.</td>
167
  </tr>
168
 
169
- <tr>
170
- <td align="left"><code>show_download_button</code></td>
171
- <td align="left" style="width: 25%;">
172
-
173
- ```python
174
- bool
175
- ```
176
-
177
- </td>
178
- <td align="left"><code>True</code></td>
179
- <td align="left">If True, will display button to download image.</td>
180
- </tr>
181
-
182
  <tr>
183
  <td align="left"><code>container</code></td>
184
  <td align="left" style="width: 25%;">
@@ -232,20 +300,20 @@ int | str
232
  </tr>
233
 
234
  <tr>
235
- <td align="left"><code>interactive</code></td>
236
  <td align="left" style="width: 25%;">
237
 
238
  ```python
239
- bool | None
240
  ```
241
 
242
  </td>
243
- <td align="left"><code>None</code></td>
244
- <td align="left">if True, will allow users to upload and edit an image; if False, can only be used to display images. If not provided, this is inferred based on whether the component is used as an input or output.</td>
245
  </tr>
246
 
247
  <tr>
248
- <td align="left"><code>visible</code></td>
249
  <td align="left" style="width: 25%;">
250
 
251
  ```python
@@ -253,8 +321,8 @@ bool
253
  ```
254
 
255
  </td>
256
- <td align="left"><code>True</code></td>
257
- <td align="left">If False, component will be hidden.</td>
258
  </tr>
259
 
260
  <tr>
@@ -297,13 +365,8 @@ bool
297
  </tr>
298
  </tbody></table>
299
 
300
- ### Events
301
 
302
- | name | description |
303
- | :------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
304
- | `clear` | This listener is triggered when the user clears the Rerun using the X button for the component. |
305
- | `change` | Triggered when the value of the Rerun changes either because of user input (e.g. a user types in a textbox) OR because of a function update (e.g. an image receives a value from the output of an event trigger). See `.input()` for a listener that is only triggered by user input. |
306
- | `upload` | This listener is triggered when the user uploads a file into the Rerun. |
307
 
308
  ### User function
309
 
@@ -314,15 +377,19 @@ The impact on the users predict function varies depending on whether the compone
314
 
315
  The code snippet below is accurate in cases where the component is used as both an input and an output.
316
 
317
- - **As output:** Is passed, a `str` containing the path to the image.
318
- - **As input:** Should return, expects a `str` or `pathlib.Path` object containing the path to the image.
 
 
 
 
 
 
 
 
319
 
 
320
  ```python
321
- def predict(
322
- value: str | None
323
- ) -> list[gradio.data_classes.FileData]
324
- | gradio.data_classes.FileData
325
- | str
326
- | list[str]:
327
- return value
328
  ```
 
1
  ---
2
+ tags: [gradio-custom-component, SimpleImage, multimodal data, visualization, machine learning, robotics]
 
 
 
 
 
 
 
 
3
  title: gradio_rerun
4
  short_description: Rerun viewer with Gradio
5
  colorFrom: blue
6
  colorTo: yellow
7
  sdk: gradio
 
8
  pinned: false
9
  app_file: space.py
10
  ---
11
 
12
  # `gradio_rerun`
13
+ <a href="https://pypi.org/project/gradio_rerun/" target="_blank"><img alt="PyPI - Version" src="https://img.shields.io/pypi/v/gradio_rerun"></a> <a href="https://github.com/radames/gradio-rerun-viewer/issues" target="_blank"><img alt="Static Badge" src="https://img.shields.io/badge/Issues-white?logo=github&logoColor=black"></a>
 
14
 
15
  Rerun viewer with Gradio
16
 
 
23
  ## Usage
24
 
25
  ```python
26
+ import cv2
27
+ import os
28
+ import tempfile
29
+ import time
30
+
31
  import gradio as gr
32
  from gradio_rerun import Rerun
33
 
34
+ import rerun as rr
35
+ import rerun.blueprint as rrb
36
 
37
+ from color_grid import build_color_grid
38
 
39
+ # NOTE: Functions that work with Rerun should be decorated with `@rr.thread_local_stream`.
40
+ # This decorator creates a generator-aware thread-local context so that rerun log calls
41
+ # across multiple workers stay isolated.
42
 
 
 
 
 
43
 
44
+ # A task can directly log to a binary stream, which is routed to the embedded viewer.
45
+ # Incremental chunks are yielded to the viewer using `yield stream.read()`.
46
+ #
47
+ # This is the preferred way to work with Rerun in Gradio since your data can be immediately and
48
+ # incrementally seen by the viewer. Also, there are no ephemeral RRDs to cleanup or manage.
49
+ @rr.thread_local_stream("rerun_example_streaming_blur")
50
+ def streaming_repeated_blur(img):
51
+ stream = rr.binary_stream()
52
 
53
+ if img is None:
54
+ raise gr.Error("Must provide an image to blur.")
55
+
56
+ blueprint = rrb.Blueprint(
57
+ rrb.Horizontal(
58
+ rrb.Spatial2DView(origin="image/original"),
59
+ rrb.Spatial2DView(origin="image/blurred"),
60
+ ),
61
+ collapse_panels=True,
62
+ )
63
+
64
+ rr.send_blueprint(blueprint)
65
+
66
+ rr.set_time_sequence("iteration", 0)
67
+
68
+ rr.log("image/original", rr.Image(img))
69
+ yield stream.read()
70
+
71
+ blur = img
72
+
73
+ for i in range(100):
74
+ rr.set_time_sequence("iteration", i)
75
+
76
+ # Pretend blurring takes a while so we can see streaming in action.
77
+ time.sleep(0.1)
78
+ blur = cv2.GaussianBlur(blur, (5, 5), 0)
79
+
80
+ rr.log("image/blurred", rr.Image(blur))
81
+
82
+ # Each time we yield bytes from the stream back to Gradio, they
83
+ # are incrementally sent to the viewer. Make sure to yield any time
84
+ # you want the user to be able to see progress.
85
+ yield stream.read()
86
+
87
+
88
+ # However, if you have a workflow that creates an RRD file instead, you can still send it
89
+ # directly to the viewer by simply returning the path to the RRD file.
90
+ #
91
+ # This may be helpful if you need to execute a helper tool written in C++ or Rust that can't
92
+ # be easily modified to stream data directly via Gradio.
93
+ #
94
+ # In this case you may want to clean up the RRD file after it's sent to the viewer so that you
95
+ # don't accumulate too many temporary files.
96
+ @rr.thread_local_stream("rerun_example_cube_rrd")
97
+ def create_cube_rrd(x, y, z, pending_cleanup):
98
+ cube = build_color_grid(int(x), int(y), int(z), twist=0)
99
+ rr.log("cube", rr.Points3D(cube.positions, colors=cube.colors, radii=0.5))
100
+
101
+ # We eventually want to clean up the RRD file after it's sent to the viewer, so tracking
102
+ # any pending files to be cleaned up when the state is deleted.
103
+ temp = tempfile.NamedTemporaryFile(prefix="cube_", suffix=".rrd", delete=False)
104
+ pending_cleanup.append(temp.name)
105
+
106
+ blueprint = rrb.Spatial3DView(origin="cube")
107
+ rr.save(temp.name, default_blueprint=blueprint)
108
+
109
+ # Just return the name of the file -- Gradio will convert it to a FileData object
110
+ # and send it to the viewer.
111
+ return temp.name
112
+
113
+
114
+ def cleanup_cube_rrds(pending_cleanup):
115
+ for f in pending_cleanup:
116
+ os.unlink(f)
117
+
118
+
119
+ with gr.Blocks() as demo:
120
+ with gr.Tab("Streaming"):
121
+ with gr.Row():
122
+ img = gr.Image(interactive=True, label="Image")
123
+ with gr.Column():
124
+ stream_blur = gr.Button("Stream Repeated Blur")
125
+
126
+ with gr.Tab("Dynamic RRD"):
127
+ pending_cleanup = gr.State(
128
+ [], time_to_live=10, delete_callback=cleanup_cube_rrds
129
+ )
130
+ with gr.Row():
131
+ x_count = gr.Number(
132
+ minimum=1, maximum=10, value=5, precision=0, label="X Count"
133
+ )
134
+ y_count = gr.Number(
135
+ minimum=1, maximum=10, value=5, precision=0, label="Y Count"
136
+ )
137
+ z_count = gr.Number(
138
+ minimum=1, maximum=10, value=5, precision=0, label="Z Count"
139
+ )
140
+ with gr.Row():
141
+ create_rrd = gr.Button("Create RRD")
142
+
143
+ with gr.Tab("Hosted RRD"):
144
+ with gr.Row():
145
+ # It may be helpful to point the viewer to a hosted RRD file on another server.
146
+ # If an RRD file is hosted via http, you can just return a URL to the file.
147
+ choose_rrd = gr.Dropdown(
148
+ label="RRD",
149
+ choices=[
150
+ f"{rr.bindings.get_app_url()}/examples/arkit_scenes.rrd",
151
+ f"{rr.bindings.get_app_url()}/examples/dna.rrd",
152
+ f"{rr.bindings.get_app_url()}/examples/plots.rrd",
153
+ ],
154
+ )
155
+
156
+ # Rerun 0.16 has issues when embedded in a Gradio tab, so we share a viewer between all the tabs.
157
+ # In 0.17 we can instead scope each viewer to its own tab to clean up these examples further.
158
  with gr.Row():
159
+ viewer = Rerun(
160
+ streaming=True,
161
+ )
162
+
163
+ stream_blur.click(streaming_repeated_blur, inputs=[img], outputs=[viewer])
164
+
165
+ create_rrd.click(
166
+ create_cube_rrd,
167
+ inputs=[x_count, y_count, z_count, pending_cleanup],
168
+ outputs=[viewer],
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
169
  )
170
 
171
+ choose_rrd.change(lambda x: x, inputs=[choose_rrd], outputs=[viewer])
172
+
173
+
174
  if __name__ == "__main__":
175
  demo.launch()
176
 
 
195
  <td align="left" style="width: 25%;">
196
 
197
  ```python
198
+ list[pathlib.Path | str]
199
+ | pathlib.Path
200
+ | str
201
+ | bytes
202
+ | Callable
203
+ | None
204
  ```
205
 
206
  </td>
207
  <td align="left"><code>None</code></td>
208
+ <td align="left">Takes a singular or list of RRD resources. Each RRD can be a Path, a string containing a url, or a binary blob containing encoded RRD data. If callable, the function will be called whenever the app loads to set the initial value of the component.</td>
209
  </tr>
210
 
211
  <tr>
 
247
  <td align="left">if True, will display label.</td>
248
  </tr>
249
 
 
 
 
 
 
 
 
 
 
 
 
 
 
250
  <tr>
251
  <td align="left"><code>container</code></td>
252
  <td align="left" style="width: 25%;">
 
300
  </tr>
301
 
302
  <tr>
303
+ <td align="left"><code>visible</code></td>
304
  <td align="left" style="width: 25%;">
305
 
306
  ```python
307
+ bool
308
  ```
309
 
310
  </td>
311
+ <td align="left"><code>True</code></td>
312
+ <td align="left">If False, component will be hidden.</td>
313
  </tr>
314
 
315
  <tr>
316
+ <td align="left"><code>streaming</code></td>
317
  <td align="left" style="width: 25%;">
318
 
319
  ```python
 
321
  ```
322
 
323
  </td>
324
+ <td align="left"><code>False</code></td>
325
+ <td align="left">If True, the data should be incrementally yielded from the source as `bytes` returned by calling `.read()` on an `rr.binary_stream()`</td>
326
  </tr>
327
 
328
  <tr>
 
365
  </tr>
366
  </tbody></table>
367
 
 
368
 
369
+
 
 
 
 
370
 
371
  ### User function
372
 
 
377
 
378
  The code snippet below is accurate in cases where the component is used as both an input and an output.
379
 
380
+ - **As output:** Is passed, a RerunData object.
381
+ - **As input:** Should return, expects.
382
+
383
+ ```python
384
+ def predict(
385
+ value: RerunData | None
386
+ ) -> list[pathlib.Path | str] | pathlib.Path | str | bytes:
387
+ return value
388
+ ```
389
+
390
 
391
+ ## `RerunData`
392
  ```python
393
+ class RerunData(GradioRootModel):
394
+ root: list[FileData | str]
 
 
 
 
 
395
  ```
app.py CHANGED
@@ -1,64 +1,150 @@
 
 
 
 
 
1
  import gradio as gr
2
  from gradio_rerun import Rerun
3
 
 
 
4
 
5
- example = Rerun().example_value()
6
 
 
 
 
7
 
8
- def predict(url: str, file_path: str | list[str] | None):
9
- if url:
10
- return url
11
- return file_path
12
 
 
 
 
 
 
 
 
 
13
 
14
- with gr.Blocks(css=".gradio-container { max-width: unset!important; }") as demo:
15
- with gr.Row():
16
- with gr.Column():
17
- with gr.Group():
18
- file_path = gr.File(file_count="multiple", type="filepath")
19
- url = gr.Text(
20
- info="Or use a URL",
21
- label="URL",
22
- )
23
- with gr.Column():
24
- pass
25
- btn = gr.Button("Run", scale=0)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
26
  with gr.Row():
27
- rerun_viewer = Rerun(height=900)
28
-
29
- inputs = [file_path, url]
30
- outputs = [rerun_viewer]
31
-
32
- gr.on([btn.click, file_path.upload], fn=predict, inputs=inputs, outputs=outputs)
33
-
34
- gr.Examples(
35
- examples=[
36
- [
37
- None,
38
- "https://app.rerun.io/version/0.15.1/examples/detect_and_track_objects.rrd",
39
- ],
40
- [
41
- ["./examples/rgbd.rrd"],
42
- None,
43
- ],
44
- [
45
- ["./examples/rrt-star.rrd"],
46
- None,
47
- ],
48
- [
49
- ["./examples/structure_from_motion.rrd"],
50
- None,
51
- ],
52
- [
53
- ["./examples/structure_from_motion.rrd", "./examples/rrt-star.rrd"],
54
- None,
55
- ],
56
- ],
57
- fn=predict,
58
- inputs=inputs,
59
- outputs=outputs,
60
- run_on_click=True,
61
  )
62
 
 
 
 
63
  if __name__ == "__main__":
64
  demo.launch()
 
1
+ import cv2
2
+ import os
3
+ import tempfile
4
+ import time
5
+
6
  import gradio as gr
7
  from gradio_rerun import Rerun
8
 
9
+ import rerun as rr
10
+ import rerun.blueprint as rrb
11
 
12
+ from color_grid import build_color_grid
13
 
14
+ # NOTE: Functions that work with Rerun should be decorated with `@rr.thread_local_stream`.
15
+ # This decorator creates a generator-aware thread-local context so that rerun log calls
16
+ # across multiple workers stay isolated.
17
 
 
 
 
 
18
 
19
+ # A task can directly log to a binary stream, which is routed to the embedded viewer.
20
+ # Incremental chunks are yielded to the viewer using `yield stream.read()`.
21
+ #
22
+ # This is the preferred way to work with Rerun in Gradio since your data can be immediately and
23
+ # incrementally seen by the viewer. Also, there are no ephemeral RRDs to cleanup or manage.
24
+ @rr.thread_local_stream("rerun_example_streaming_blur")
25
+ def streaming_repeated_blur(img):
26
+ stream = rr.binary_stream()
27
 
28
+ if img is None:
29
+ raise gr.Error("Must provide an image to blur.")
30
+
31
+ blueprint = rrb.Blueprint(
32
+ rrb.Horizontal(
33
+ rrb.Spatial2DView(origin="image/original"),
34
+ rrb.Spatial2DView(origin="image/blurred"),
35
+ ),
36
+ collapse_panels=True,
37
+ )
38
+
39
+ rr.send_blueprint(blueprint)
40
+
41
+ rr.set_time_sequence("iteration", 0)
42
+
43
+ rr.log("image/original", rr.Image(img))
44
+ yield stream.read()
45
+
46
+ blur = img
47
+
48
+ for i in range(100):
49
+ rr.set_time_sequence("iteration", i)
50
+
51
+ # Pretend blurring takes a while so we can see streaming in action.
52
+ time.sleep(0.1)
53
+ blur = cv2.GaussianBlur(blur, (5, 5), 0)
54
+
55
+ rr.log("image/blurred", rr.Image(blur))
56
+
57
+ # Each time we yield bytes from the stream back to Gradio, they
58
+ # are incrementally sent to the viewer. Make sure to yield any time
59
+ # you want the user to be able to see progress.
60
+ yield stream.read()
61
+
62
+
63
+ # However, if you have a workflow that creates an RRD file instead, you can still send it
64
+ # directly to the viewer by simply returning the path to the RRD file.
65
+ #
66
+ # This may be helpful if you need to execute a helper tool written in C++ or Rust that can't
67
+ # be easily modified to stream data directly via Gradio.
68
+ #
69
+ # In this case you may want to clean up the RRD file after it's sent to the viewer so that you
70
+ # don't accumulate too many temporary files.
71
+ @rr.thread_local_stream("rerun_example_cube_rrd")
72
+ def create_cube_rrd(x, y, z, pending_cleanup):
73
+ cube = build_color_grid(int(x), int(y), int(z), twist=0)
74
+ rr.log("cube", rr.Points3D(cube.positions, colors=cube.colors, radii=0.5))
75
+
76
+ # We eventually want to clean up the RRD file after it's sent to the viewer, so tracking
77
+ # any pending files to be cleaned up when the state is deleted.
78
+ temp = tempfile.NamedTemporaryFile(prefix="cube_", suffix=".rrd", delete=False)
79
+ pending_cleanup.append(temp.name)
80
+
81
+ blueprint = rrb.Spatial3DView(origin="cube")
82
+ rr.save(temp.name, default_blueprint=blueprint)
83
+
84
+ # Just return the name of the file -- Gradio will convert it to a FileData object
85
+ # and send it to the viewer.
86
+ return temp.name
87
+
88
+
89
+ def cleanup_cube_rrds(pending_cleanup):
90
+ for f in pending_cleanup:
91
+ os.unlink(f)
92
+
93
+
94
+ with gr.Blocks() as demo:
95
+ with gr.Tab("Streaming"):
96
+ with gr.Row():
97
+ img = gr.Image(interactive=True, label="Image")
98
+ with gr.Column():
99
+ stream_blur = gr.Button("Stream Repeated Blur")
100
+
101
+ with gr.Tab("Dynamic RRD"):
102
+ pending_cleanup = gr.State(
103
+ [], time_to_live=10, delete_callback=cleanup_cube_rrds
104
+ )
105
+ with gr.Row():
106
+ x_count = gr.Number(
107
+ minimum=1, maximum=10, value=5, precision=0, label="X Count"
108
+ )
109
+ y_count = gr.Number(
110
+ minimum=1, maximum=10, value=5, precision=0, label="Y Count"
111
+ )
112
+ z_count = gr.Number(
113
+ minimum=1, maximum=10, value=5, precision=0, label="Z Count"
114
+ )
115
+ with gr.Row():
116
+ create_rrd = gr.Button("Create RRD")
117
+
118
+ with gr.Tab("Hosted RRD"):
119
+ with gr.Row():
120
+ # It may be helpful to point the viewer to a hosted RRD file on another server.
121
+ # If an RRD file is hosted via http, you can just return a URL to the file.
122
+ choose_rrd = gr.Dropdown(
123
+ label="RRD",
124
+ choices=[
125
+ f"{rr.bindings.get_app_url()}/examples/arkit_scenes.rrd",
126
+ f"{rr.bindings.get_app_url()}/examples/dna.rrd",
127
+ f"{rr.bindings.get_app_url()}/examples/plots.rrd",
128
+ ],
129
+ )
130
+
131
+ # Rerun 0.16 has issues when embedded in a Gradio tab, so we share a viewer between all the tabs.
132
+ # In 0.17 we can instead scope each viewer to its own tab to clean up these examples further.
133
  with gr.Row():
134
+ viewer = Rerun(
135
+ streaming=True,
136
+ )
137
+
138
+ stream_blur.click(streaming_repeated_blur, inputs=[img], outputs=[viewer])
139
+
140
+ create_rrd.click(
141
+ create_cube_rrd,
142
+ inputs=[x_count, y_count, z_count, pending_cleanup],
143
+ outputs=[viewer],
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
144
  )
145
 
146
+ choose_rrd.change(lambda x: x, inputs=[choose_rrd], outputs=[viewer])
147
+
148
+
149
  if __name__ == "__main__":
150
  demo.launch()
color_grid.py ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import numpy as np
2
+ from math import cos, sin
3
+ from collections import namedtuple
4
+
5
+ ColorGrid = namedtuple("ColorGrid", ["positions", "colors"])
6
+
7
+
8
+ def build_color_grid(x_count=10, y_count=10, z_count=10, twist=0):
9
+ """
10
+ Create a cube of points with colors.
11
+
12
+ The total point cloud will have x_count * y_count * z_count points.
13
+
14
+ Parameters
15
+ ----------
16
+ x_count, y_count, z_count:
17
+ Number of points in each dimension.
18
+ twist:
19
+ Angle to twist from bottom to top of the cube
20
+
21
+ """
22
+
23
+ grid = np.mgrid[
24
+ slice(-x_count, x_count, x_count * 1j),
25
+ slice(-y_count, y_count, y_count * 1j),
26
+ slice(-z_count, z_count, z_count * 1j),
27
+ ]
28
+
29
+ angle = np.linspace(-float(twist) / 2, float(twist) / 2, z_count)
30
+ for z in range(z_count):
31
+ xv, yv, zv = grid[:, :, :, z]
32
+ rot_xv = xv * cos(angle[z]) - yv * sin(angle[z])
33
+ rot_yv = xv * sin(angle[z]) + yv * cos(angle[z])
34
+ grid[:, :, :, z] = [rot_xv, rot_yv, zv]
35
+
36
+ positions = np.vstack([xyz.ravel() for xyz in grid])
37
+
38
+ colors = np.vstack(
39
+ [
40
+ xyz.ravel()
41
+ for xyz in np.mgrid[
42
+ slice(0, 255, x_count * 1j),
43
+ slice(0, 255, y_count * 1j),
44
+ slice(0, 255, z_count * 1j),
45
+ ]
46
+ ]
47
+ )
48
+
49
+ return ColorGrid(positions.T, colors.T.astype(np.uint8))
css.css CHANGED
@@ -1,156 +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
- .gradio-container {
23
- max-width: unset !important;
 
24
  }
25
 
26
  .prose p {
27
- margin: var(--vspace) 0;
28
- line-height: var(--vspace * 2);
29
- font-size: 1rem;
30
  }
31
 
32
  code {
33
- font-family: "Inconsolata", sans-serif;
34
- font-size: 16px;
35
  }
36
 
37
  h1,
38
  h1 code {
39
- font-weight: 400;
40
- line-height: calc(2.5 / var(--space) * var(--vspace));
41
  }
42
 
43
  h1 code {
44
- background: none;
45
- border: none;
46
- letter-spacing: 0.05em;
47
- padding-bottom: 5px;
48
- position: relative;
49
- padding: 0;
50
  }
51
 
52
  h2 {
53
- margin: var(--vspace-1) 0 var(--vspace-2) 0;
54
- line-height: 1em;
55
  }
56
 
57
  h3,
58
  h3 code {
59
- margin: var(--vspace-1) 0 var(--vspace-2) 0;
60
- line-height: 1em;
61
  }
62
 
63
  h4,
64
  h5,
65
  h6 {
66
- margin: var(--vspace-3) 0 var(--vspace-3) 0;
67
- line-height: var(--vspace);
68
  }
69
 
70
  .bigtitle,
71
  h1,
72
  h1 code {
73
- font-size: calc(8px * 4.5);
74
- word-break: break-word;
75
  }
76
 
77
  .title,
78
  h2,
79
  h2 code {
80
- font-size: calc(8px * 3.375);
81
- font-weight: lighter;
82
- word-break: break-word;
83
- border: none;
84
- background: none;
85
  }
86
 
87
  .subheading1,
88
  h3,
89
  h3 code {
90
- font-size: calc(8px * 1.8);
91
- font-weight: 600;
92
- border: none;
93
- background: none;
94
- letter-spacing: 0.1em;
95
- text-transform: uppercase;
96
  }
97
 
98
  h2 code {
99
- padding: 0;
100
- position: relative;
101
- letter-spacing: 0.05em;
102
  }
103
 
104
  blockquote {
105
- font-size: calc(8px * 1.1667);
106
- font-style: italic;
107
- line-height: calc(1.1667 * var(--vspace));
108
- margin: var(--vspace-2) var(--vspace-2);
109
  }
110
 
111
  .subheading2,
112
  h4 {
113
- font-size: calc(8px * 1.4292);
114
- text-transform: uppercase;
115
- font-weight: 600;
116
  }
117
 
118
  .subheading3,
119
  h5 {
120
- font-size: calc(8px * 1.2917);
121
- line-height: calc(1.2917 * var(--vspace));
122
 
123
- font-weight: lighter;
124
- text-transform: uppercase;
125
- letter-spacing: 0.15em;
126
  }
127
 
128
  h6 {
129
- font-size: calc(8px * 1.1667);
130
- font-size: 1.1667em;
131
- font-weight: normal;
132
- font-style: italic;
133
- font-family: "le-monde-livre-classic-byol", serif !important;
134
- letter-spacing: 0px !important;
135
  }
136
 
137
  #start .md > *:first-child {
138
- margin-top: 0;
139
  }
140
 
141
  h2 + h3 {
142
- margin-top: 0;
143
  }
144
 
145
  .md hr {
146
- border: none;
147
- border-top: 1px solid var(--block-border-color);
148
- margin: var(--vspace-2) 0 var(--vspace-2) 0;
149
  }
150
  .prose ul {
151
- margin: var(--vspace-2) 0 var(--vspace-1) 0;
152
  }
153
 
154
  .gap {
155
- gap: 0;
156
  }
 
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 CHANGED
@@ -1 +1,2 @@
1
- gradio_rerun
 
 
1
+ gradio_rerun
2
+ opencv-python
space.py CHANGED
@@ -3,7 +3,7 @@ import gradio as gr
3
  from app import demo as app
4
  import os
5
 
6
- _docs = {'Rerun': {'description': 'Creates an image component that can be used to upload images (as an input) or display images (as an output).', 'members': {'__init__': {'value': {'type': 'list[str] | None', 'default': 'None', 'description': 'A path or URL for the default value that Rerun component is going to take. If callable, the function will be called whenever the app loads to set the initial value of the component.'}, 'label': {'type': 'str | None', 'default': 'None', 'description': 'The label for this component. Appears above the component and is also used as the header if there are a table of examples for this component. If None and used in a `gr.Interface`, the label will be the name of the parameter this component is assigned to.'}, 'every': {'type': 'float | None', 'default': 'None', 'description': "If `value` is a callable, run the function 'every' number of seconds while the client connection is open. Has no effect otherwise. Queue must be enabled. The event can be accessed (e.g. to cancel it) via this component's .load_event attribute."}, 'show_label': {'type': 'bool | None', 'default': 'None', 'description': 'if True, will display label.'}, 'show_download_button': {'type': 'bool', 'default': 'True', 'description': 'If True, will display button to download image.'}, 'container': {'type': 'bool', 'default': 'True', 'description': 'If True, will place the component in a container - providing some extra padding around the border.'}, 'scale': {'type': 'int | None', 'default': 'None', 'description': 'relative size compared to adjacent Components. For example if Components A and B are in a Row, and A has scale=2, and B has scale=1, A will be twice as wide as B. Should be an integer. scale applies in Rows, and to top-level Components in Blocks where fill_height=True.'}, 'min_width': {'type': 'int', 'default': '160', 'description': 'minimum pixel width, will wrap if not sufficient screen space to satisfy this value. If a certain scale value results in this Component being narrower than min_width, the min_width parameter will be respected first.'}, 'height': {'type': 'int | str', 'default': '640', 'description': 'height of component in pixels. If a string is provided, will be interpreted as a CSS value. If None, will be set to 640px.'}, 'interactive': {'type': 'bool | None', 'default': 'None', 'description': 'if True, will allow users to upload and edit an image; if False, can only be used to display images. If not provided, this is inferred based on whether the component is used as an input or output.'}, 'visible': {'type': 'bool', 'default': 'True', 'description': 'If False, component 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 list of strings that are assigned as the classes of this component in the HTML DOM. Can be used for targeting CSS styles.'}, 'render': {'type': 'bool', 'default': 'True', 'description': 'If False, component will not render be rendered in the Blocks context. Should be used if the intention is to assign event listeners now but render the component later.'}}, 'postprocess': {'value': {'type': 'list[gradio.data_classes.FileData]\n | gradio.data_classes.FileData\n | str\n | list[str]', 'description': 'Expects a `str` or `pathlib.Path` object containing the path to the image.'}}, 'preprocess': {'return': {'type': 'str | None', 'description': 'A `str` containing the path to the image.'}, 'value': None}}, 'events': {'clear': {'type': None, 'default': None, 'description': 'This listener is triggered when the user clears the Rerun using the X button for the component.'}, 'change': {'type': None, 'default': None, 'description': 'Triggered when the value of the Rerun changes either because of user input (e.g. a user types in a textbox) OR because of a function update (e.g. an image receives a value from the output of an event trigger). See `.input()` for a listener that is only triggered by user input.'}, 'upload': {'type': None, 'default': None, 'description': 'This listener is triggered when the user uploads a file into the Rerun.'}}}, '__meta__': {'additional_interfaces': {}, 'user_fn_refs': {'Rerun': []}}}
7
 
8
  abs_path = os.path.join(os.path.dirname(__file__), "css.css")
9
 
@@ -21,7 +21,7 @@ with gr.Blocks(
21
  # `gradio_rerun`
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"> <a href="https://github.com/radames/gradio-rerun-viewer/issues" target="_blank"><img alt="Static Badge" src="https://img.shields.io/badge/Issues-white?logo=github&logoColor=black"></a>
25
  </div>
26
 
27
  Rerun viewer with Gradio
@@ -38,68 +38,154 @@ pip install gradio_rerun
38
  ## Usage
39
 
40
  ```python
 
 
 
 
 
41
  import gradio as gr
42
  from gradio_rerun import Rerun
43
 
 
 
44
 
45
- example = Rerun().example_value()
46
 
 
 
 
47
 
48
- def predict(url: str, file_path: str | list[str] | None):
49
- if url:
50
- return url
51
- return file_path
52
 
 
 
 
 
 
 
 
 
53
 
54
- with gr.Blocks(css=".gradio-container { max-width: unset!important; }") as demo:
55
- with gr.Row():
56
- with gr.Column():
57
- with gr.Group():
58
- file_path = gr.File(file_count="multiple", type="filepath")
59
- url = gr.Text(
60
- info="Or use a URL",
61
- label="URL",
62
- )
63
- with gr.Column():
64
- pass
65
- btn = gr.Button("Run", scale=0)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
66
  with gr.Row():
67
- rerun_viewer = Rerun(height=900)
68
-
69
- inputs = [file_path, url]
70
- outputs = [rerun_viewer]
71
-
72
- gr.on([btn.click, file_path.upload], fn=predict, inputs=inputs, outputs=outputs)
73
-
74
- gr.Examples(
75
- examples=[
76
- [
77
- None,
78
- "https://app.rerun.io/version/0.15.1/examples/detect_and_track_objects.rrd",
79
- ],
80
- [
81
- ["./examples/rgbd.rrd"],
82
- None,
83
- ],
84
- [
85
- ["./examples/rrt-star.rrd"],
86
- None,
87
- ],
88
- [
89
- ["./examples/structure_from_motion.rrd"],
90
- None,
91
- ],
92
- [
93
- ["./examples/structure_from_motion.rrd", "./examples/rrt-star.rrd"],
94
- None,
95
- ],
96
- ],
97
- fn=predict,
98
- inputs=inputs,
99
- outputs=outputs,
100
- run_on_click=True,
101
  )
102
 
 
 
 
103
  if __name__ == "__main__":
104
  demo.launch()
105
 
@@ -113,11 +199,7 @@ if __name__ == "__main__":
113
  ### Initialization
114
  """, elem_classes=["md-custom"], header_links=True)
115
 
116
- gr.ParamViewer(value=_docs["Rerun"]["members"]["__init__"], linkify=[])
117
-
118
-
119
- gr.Markdown("### Events")
120
- gr.ParamViewer(value=_docs["Rerun"]["events"], linkify=['Event'])
121
 
122
 
123
 
@@ -133,16 +215,13 @@ The impact on the users predict function varies depending on whether the compone
133
 
134
  The code snippet below is accurate in cases where the component is used as both an input and an output.
135
 
136
- - **As input:** Is passed, a `str` containing the path to the image.
137
- - **As output:** Should return, expects a `str` or `pathlib.Path` object containing the path to the image.
138
 
139
  ```python
140
  def predict(
141
- value: str | None
142
- ) -> list[gradio.data_classes.FileData]
143
- | gradio.data_classes.FileData
144
- | str
145
- | list[str]:
146
  return value
147
  ```
148
  """, elem_classes=["md-custom", "Rerun-user-fn"], header_links=True)
@@ -150,10 +229,18 @@ def predict(
150
 
151
 
152
 
 
 
 
 
 
 
 
153
  demo.load(None, js=r"""function() {
154
- const refs = {};
 
155
  const user_fn_refs = {
156
- Rerun: [], };
157
  requestAnimationFrame(() => {
158
 
159
  Object.entries(user_fn_refs).forEach(([key, refs]) => {
 
3
  from app import demo as app
4
  import os
5
 
6
+ _docs = {'Rerun': {'description': 'Creates a Rerun viewer component that can be used to display the output of a Rerun stream.', 'members': {'__init__': {'value': {'type': 'list[pathlib.Path | str]\n | pathlib.Path\n | str\n | bytes\n | Callable\n | None', 'default': 'None', 'description': 'Takes a singular or list of RRD resources. Each RRD can be a Path, a string containing a url, or a binary blob containing encoded RRD data. If callable, the function will be called whenever the app loads to set the initial value of the component.'}, 'label': {'type': 'str | None', 'default': 'None', 'description': 'The label for this component. Appears above the component and is also used as the header if there are a table of examples for this component. If None and used in a `gr.Interface`, the label will be the name of the parameter this component is assigned to.'}, 'every': {'type': 'float | None', 'default': 'None', 'description': "If `value` is a callable, run the function 'every' number of seconds while the client connection is open. Has no effect otherwise. Queue must be enabled. The event can be accessed (e.g. to cancel it) via this component's .load_event attribute."}, 'show_label': {'type': 'bool | None', 'default': 'None', 'description': 'if True, will display label.'}, 'container': {'type': 'bool', 'default': 'True', 'description': 'If True, will place the component in a container - providing some extra padding around the border.'}, 'scale': {'type': 'int | None', 'default': 'None', 'description': 'relative size compared to adjacent Components. For example if Components A and B are in a Row, and A has scale=2, and B has scale=1, A will be twice as wide as B. Should be an integer. scale applies in Rows, and to top-level Components in Blocks where fill_height=True.'}, 'min_width': {'type': 'int', 'default': '160', 'description': 'minimum pixel width, will wrap if not sufficient screen space to satisfy this value. If a certain scale value results in this Component being narrower than min_width, the min_width parameter will be respected first.'}, 'height': {'type': 'int | str', 'default': '640', 'description': 'height of component in pixels. If a string is provided, will be interpreted as a CSS value. If None, will be set to 640px.'}, 'visible': {'type': 'bool', 'default': 'True', 'description': 'If False, component will be hidden.'}, 'streaming': {'type': 'bool', 'default': 'False', 'description': 'If True, the data should be incrementally yielded from the source as `bytes` returned by calling `.read()` on an `rr.binary_stream()`'}, '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 list of strings that are assigned as the classes of this component in the HTML DOM. Can be used for targeting CSS styles.'}, 'render': {'type': 'bool', 'default': 'True', 'description': 'If False, component will not render be rendered in the Blocks context. Should be used if the intention is to assign event listeners now but render the component later.'}}, 'postprocess': {'value': {'type': 'list[pathlib.Path | str] | pathlib.Path | str | bytes', 'description': 'Expects'}}, 'preprocess': {'return': {'type': 'RerunData | None', 'description': 'A RerunData object.'}, 'value': None}}, 'events': {}}, '__meta__': {'additional_interfaces': {'RerunData': {'source': 'class RerunData(GradioRootModel):\n root: list[FileData | str]'}}, 'user_fn_refs': {'Rerun': ['RerunData']}}}
7
 
8
  abs_path = os.path.join(os.path.dirname(__file__), "css.css")
9
 
 
21
  # `gradio_rerun`
22
 
23
  <div style="display: flex; gap: 7px;">
24
+ <a href="https://pypi.org/project/gradio_rerun/" target="_blank"><img alt="PyPI - Version" src="https://img.shields.io/pypi/v/gradio_rerun"></a> <a href="https://github.com/radames/gradio-rerun-viewer/issues" target="_blank"><img alt="Static Badge" src="https://img.shields.io/badge/Issues-white?logo=github&logoColor=black"></a>
25
  </div>
26
 
27
  Rerun viewer with Gradio
 
38
  ## Usage
39
 
40
  ```python
41
+ import cv2
42
+ import os
43
+ import tempfile
44
+ import time
45
+
46
  import gradio as gr
47
  from gradio_rerun import Rerun
48
 
49
+ import rerun as rr
50
+ import rerun.blueprint as rrb
51
 
52
+ from color_grid import build_color_grid
53
 
54
+ # NOTE: Functions that work with Rerun should be decorated with `@rr.thread_local_stream`.
55
+ # This decorator creates a generator-aware thread-local context so that rerun log calls
56
+ # across multiple workers stay isolated.
57
 
 
 
 
 
58
 
59
+ # A task can directly log to a binary stream, which is routed to the embedded viewer.
60
+ # Incremental chunks are yielded to the viewer using `yield stream.read()`.
61
+ #
62
+ # This is the preferred way to work with Rerun in Gradio since your data can be immediately and
63
+ # incrementally seen by the viewer. Also, there are no ephemeral RRDs to cleanup or manage.
64
+ @rr.thread_local_stream("rerun_example_streaming_blur")
65
+ def streaming_repeated_blur(img):
66
+ stream = rr.binary_stream()
67
 
68
+ if img is None:
69
+ raise gr.Error("Must provide an image to blur.")
70
+
71
+ blueprint = rrb.Blueprint(
72
+ rrb.Horizontal(
73
+ rrb.Spatial2DView(origin="image/original"),
74
+ rrb.Spatial2DView(origin="image/blurred"),
75
+ ),
76
+ collapse_panels=True,
77
+ )
78
+
79
+ rr.send_blueprint(blueprint)
80
+
81
+ rr.set_time_sequence("iteration", 0)
82
+
83
+ rr.log("image/original", rr.Image(img))
84
+ yield stream.read()
85
+
86
+ blur = img
87
+
88
+ for i in range(100):
89
+ rr.set_time_sequence("iteration", i)
90
+
91
+ # Pretend blurring takes a while so we can see streaming in action.
92
+ time.sleep(0.1)
93
+ blur = cv2.GaussianBlur(blur, (5, 5), 0)
94
+
95
+ rr.log("image/blurred", rr.Image(blur))
96
+
97
+ # Each time we yield bytes from the stream back to Gradio, they
98
+ # are incrementally sent to the viewer. Make sure to yield any time
99
+ # you want the user to be able to see progress.
100
+ yield stream.read()
101
+
102
+
103
+ # However, if you have a workflow that creates an RRD file instead, you can still send it
104
+ # directly to the viewer by simply returning the path to the RRD file.
105
+ #
106
+ # This may be helpful if you need to execute a helper tool written in C++ or Rust that can't
107
+ # be easily modified to stream data directly via Gradio.
108
+ #
109
+ # In this case you may want to clean up the RRD file after it's sent to the viewer so that you
110
+ # don't accumulate too many temporary files.
111
+ @rr.thread_local_stream("rerun_example_cube_rrd")
112
+ def create_cube_rrd(x, y, z, pending_cleanup):
113
+ cube = build_color_grid(int(x), int(y), int(z), twist=0)
114
+ rr.log("cube", rr.Points3D(cube.positions, colors=cube.colors, radii=0.5))
115
+
116
+ # We eventually want to clean up the RRD file after it's sent to the viewer, so tracking
117
+ # any pending files to be cleaned up when the state is deleted.
118
+ temp = tempfile.NamedTemporaryFile(prefix="cube_", suffix=".rrd", delete=False)
119
+ pending_cleanup.append(temp.name)
120
+
121
+ blueprint = rrb.Spatial3DView(origin="cube")
122
+ rr.save(temp.name, default_blueprint=blueprint)
123
+
124
+ # Just return the name of the file -- Gradio will convert it to a FileData object
125
+ # and send it to the viewer.
126
+ return temp.name
127
+
128
+
129
+ def cleanup_cube_rrds(pending_cleanup):
130
+ for f in pending_cleanup:
131
+ os.unlink(f)
132
+
133
+
134
+ with gr.Blocks() as demo:
135
+ with gr.Tab("Streaming"):
136
+ with gr.Row():
137
+ img = gr.Image(interactive=True, label="Image")
138
+ with gr.Column():
139
+ stream_blur = gr.Button("Stream Repeated Blur")
140
+
141
+ with gr.Tab("Dynamic RRD"):
142
+ pending_cleanup = gr.State(
143
+ [], time_to_live=10, delete_callback=cleanup_cube_rrds
144
+ )
145
+ with gr.Row():
146
+ x_count = gr.Number(
147
+ minimum=1, maximum=10, value=5, precision=0, label="X Count"
148
+ )
149
+ y_count = gr.Number(
150
+ minimum=1, maximum=10, value=5, precision=0, label="Y Count"
151
+ )
152
+ z_count = gr.Number(
153
+ minimum=1, maximum=10, value=5, precision=0, label="Z Count"
154
+ )
155
+ with gr.Row():
156
+ create_rrd = gr.Button("Create RRD")
157
+
158
+ with gr.Tab("Hosted RRD"):
159
+ with gr.Row():
160
+ # It may be helpful to point the viewer to a hosted RRD file on another server.
161
+ # If an RRD file is hosted via http, you can just return a URL to the file.
162
+ choose_rrd = gr.Dropdown(
163
+ label="RRD",
164
+ choices=[
165
+ f"{rr.bindings.get_app_url()}/examples/arkit_scenes.rrd",
166
+ f"{rr.bindings.get_app_url()}/examples/dna.rrd",
167
+ f"{rr.bindings.get_app_url()}/examples/plots.rrd",
168
+ ],
169
+ )
170
+
171
+ # Rerun 0.16 has issues when embedded in a Gradio tab, so we share a viewer between all the tabs.
172
+ # In 0.17 we can instead scope each viewer to its own tab to clean up these examples further.
173
  with gr.Row():
174
+ viewer = Rerun(
175
+ streaming=True,
176
+ )
177
+
178
+ stream_blur.click(streaming_repeated_blur, inputs=[img], outputs=[viewer])
179
+
180
+ create_rrd.click(
181
+ create_cube_rrd,
182
+ inputs=[x_count, y_count, z_count, pending_cleanup],
183
+ outputs=[viewer],
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
184
  )
185
 
186
+ choose_rrd.change(lambda x: x, inputs=[choose_rrd], outputs=[viewer])
187
+
188
+
189
  if __name__ == "__main__":
190
  demo.launch()
191
 
 
199
  ### Initialization
200
  """, elem_classes=["md-custom"], header_links=True)
201
 
202
+ gr.ParamViewer(value=_docs["Rerun"]["members"]["__init__"], linkify=['RerunData'])
 
 
 
 
203
 
204
 
205
 
 
215
 
216
  The code snippet below is accurate in cases where the component is used as both an input and an output.
217
 
218
+ - **As input:** Is passed, a RerunData object.
219
+ - **As output:** Should return, expects.
220
 
221
  ```python
222
  def predict(
223
+ value: RerunData | None
224
+ ) -> list[pathlib.Path | str] | pathlib.Path | str | bytes:
 
 
 
225
  return value
226
  ```
227
  """, elem_classes=["md-custom", "Rerun-user-fn"], header_links=True)
 
229
 
230
 
231
 
232
+ code_RerunData = gr.Markdown("""
233
+ ## `RerunData`
234
+ ```python
235
+ class RerunData(GradioRootModel):
236
+ root: list[FileData | str]
237
+ ```""", elem_classes=["md-custom", "RerunData"], header_links=True)
238
+
239
  demo.load(None, js=r"""function() {
240
+ const refs = {
241
+ RerunData: [], };
242
  const user_fn_refs = {
243
+ Rerun: ['RerunData'], };
244
  requestAnimationFrame(() => {
245
 
246
  Object.entries(user_fn_refs).forEach(([key, refs]) => {
src/README.md CHANGED
@@ -10,7 +10,7 @@ app_file: space.py
10
  ---
11
 
12
  # `gradio_rerun`
13
- <img alt="Static Badge" src="https://img.shields.io/badge/version%20-%200.0.1%20-%20orange"> <a href="https://github.com/radames/gradio-rerun-viewer/issues" target="_blank"><img alt="Static Badge" src="https://img.shields.io/badge/Issues-white?logo=github&logoColor=black"></a>
14
 
15
  Rerun viewer with Gradio
16
 
@@ -23,68 +23,154 @@ pip install gradio_rerun
23
  ## Usage
24
 
25
  ```python
 
 
 
 
 
26
  import gradio as gr
27
  from gradio_rerun import Rerun
28
 
 
 
29
 
30
- example = Rerun().example_value()
31
 
 
 
 
32
 
33
- def predict(url: str, file_path: str | list[str] | None):
34
- if url:
35
- return url
36
- return file_path
37
 
 
 
 
 
 
 
 
 
38
 
39
- with gr.Blocks(css=".gradio-container { max-width: unset!important; }") as demo:
40
- with gr.Row():
41
- with gr.Column():
42
- with gr.Group():
43
- file_path = gr.File(file_count="multiple", type="filepath")
44
- url = gr.Text(
45
- info="Or use a URL",
46
- label="URL",
47
- )
48
- with gr.Column():
49
- pass
50
- btn = gr.Button("Run", scale=0)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
51
  with gr.Row():
52
- rerun_viewer = Rerun(height=900)
53
-
54
- inputs = [file_path, url]
55
- outputs = [rerun_viewer]
56
-
57
- gr.on([btn.click, file_path.upload], fn=predict, inputs=inputs, outputs=outputs)
58
-
59
- gr.Examples(
60
- examples=[
61
- [
62
- None,
63
- "https://app.rerun.io/version/0.15.1/examples/detect_and_track_objects.rrd",
64
- ],
65
- [
66
- ["./examples/rgbd.rrd"],
67
- None,
68
- ],
69
- [
70
- ["./examples/rrt-star.rrd"],
71
- None,
72
- ],
73
- [
74
- ["./examples/structure_from_motion.rrd"],
75
- None,
76
- ],
77
- [
78
- ["./examples/structure_from_motion.rrd", "./examples/rrt-star.rrd"],
79
- None,
80
- ],
81
- ],
82
- fn=predict,
83
- inputs=inputs,
84
- outputs=outputs,
85
- run_on_click=True,
86
  )
87
 
 
 
 
88
  if __name__ == "__main__":
89
  demo.launch()
90
 
@@ -109,12 +195,17 @@ if __name__ == "__main__":
109
  <td align="left" style="width: 25%;">
110
 
111
  ```python
112
- list[str] | None
 
 
 
 
 
113
  ```
114
 
115
  </td>
116
  <td align="left"><code>None</code></td>
117
- <td align="left">A path or URL for the default value that Rerun component is going to take. If callable, the function will be called whenever the app loads to set the initial value of the component.</td>
118
  </tr>
119
 
120
  <tr>
@@ -156,19 +247,6 @@ bool | None
156
  <td align="left">if True, will display label.</td>
157
  </tr>
158
 
159
- <tr>
160
- <td align="left"><code>show_download_button</code></td>
161
- <td align="left" style="width: 25%;">
162
-
163
- ```python
164
- bool
165
- ```
166
-
167
- </td>
168
- <td align="left"><code>True</code></td>
169
- <td align="left">If True, will display button to download image.</td>
170
- </tr>
171
-
172
  <tr>
173
  <td align="left"><code>container</code></td>
174
  <td align="left" style="width: 25%;">
@@ -222,20 +300,20 @@ int | str
222
  </tr>
223
 
224
  <tr>
225
- <td align="left"><code>interactive</code></td>
226
  <td align="left" style="width: 25%;">
227
 
228
  ```python
229
- bool | None
230
  ```
231
 
232
  </td>
233
- <td align="left"><code>None</code></td>
234
- <td align="left">if True, will allow users to upload and edit an image; if False, can only be used to display images. If not provided, this is inferred based on whether the component is used as an input or output.</td>
235
  </tr>
236
 
237
  <tr>
238
- <td align="left"><code>visible</code></td>
239
  <td align="left" style="width: 25%;">
240
 
241
  ```python
@@ -243,8 +321,8 @@ bool
243
  ```
244
 
245
  </td>
246
- <td align="left"><code>True</code></td>
247
- <td align="left">If False, component will be hidden.</td>
248
  </tr>
249
 
250
  <tr>
@@ -288,14 +366,6 @@ bool
288
  </tbody></table>
289
 
290
 
291
- ### Events
292
-
293
- | name | description |
294
- |:-----|:------------|
295
- | `clear` | This listener is triggered when the user clears the Rerun using the X button for the component. |
296
- | `change` | Triggered when the value of the Rerun changes either because of user input (e.g. a user types in a textbox) OR because of a function update (e.g. an image receives a value from the output of an event trigger). See `.input()` for a listener that is only triggered by user input. |
297
- | `upload` | This listener is triggered when the user uploads a file into the Rerun. |
298
-
299
 
300
 
301
  ### User function
@@ -307,16 +377,19 @@ The impact on the users predict function varies depending on whether the compone
307
 
308
  The code snippet below is accurate in cases where the component is used as both an input and an output.
309
 
310
- - **As output:** Is passed, a `str` containing the path to the image.
311
- - **As input:** Should return, expects a `str` or `pathlib.Path` object containing the path to the image.
312
 
313
  ```python
314
  def predict(
315
- value: str | None
316
- ) -> list[gradio.data_classes.FileData]
317
- | gradio.data_classes.FileData
318
- | str
319
- | list[str]:
320
  return value
321
  ```
322
 
 
 
 
 
 
 
 
10
  ---
11
 
12
  # `gradio_rerun`
13
+ <a href="https://pypi.org/project/gradio_rerun/" target="_blank"><img alt="PyPI - Version" src="https://img.shields.io/pypi/v/gradio_rerun"></a> <a href="https://github.com/radames/gradio-rerun-viewer/issues" target="_blank"><img alt="Static Badge" src="https://img.shields.io/badge/Issues-white?logo=github&logoColor=black"></a>
14
 
15
  Rerun viewer with Gradio
16
 
 
23
  ## Usage
24
 
25
  ```python
26
+ import cv2
27
+ import os
28
+ import tempfile
29
+ import time
30
+
31
  import gradio as gr
32
  from gradio_rerun import Rerun
33
 
34
+ import rerun as rr
35
+ import rerun.blueprint as rrb
36
 
37
+ from color_grid import build_color_grid
38
 
39
+ # NOTE: Functions that work with Rerun should be decorated with `@rr.thread_local_stream`.
40
+ # This decorator creates a generator-aware thread-local context so that rerun log calls
41
+ # across multiple workers stay isolated.
42
 
 
 
 
 
43
 
44
+ # A task can directly log to a binary stream, which is routed to the embedded viewer.
45
+ # Incremental chunks are yielded to the viewer using `yield stream.read()`.
46
+ #
47
+ # This is the preferred way to work with Rerun in Gradio since your data can be immediately and
48
+ # incrementally seen by the viewer. Also, there are no ephemeral RRDs to cleanup or manage.
49
+ @rr.thread_local_stream("rerun_example_streaming_blur")
50
+ def streaming_repeated_blur(img):
51
+ stream = rr.binary_stream()
52
 
53
+ if img is None:
54
+ raise gr.Error("Must provide an image to blur.")
55
+
56
+ blueprint = rrb.Blueprint(
57
+ rrb.Horizontal(
58
+ rrb.Spatial2DView(origin="image/original"),
59
+ rrb.Spatial2DView(origin="image/blurred"),
60
+ ),
61
+ collapse_panels=True,
62
+ )
63
+
64
+ rr.send_blueprint(blueprint)
65
+
66
+ rr.set_time_sequence("iteration", 0)
67
+
68
+ rr.log("image/original", rr.Image(img))
69
+ yield stream.read()
70
+
71
+ blur = img
72
+
73
+ for i in range(100):
74
+ rr.set_time_sequence("iteration", i)
75
+
76
+ # Pretend blurring takes a while so we can see streaming in action.
77
+ time.sleep(0.1)
78
+ blur = cv2.GaussianBlur(blur, (5, 5), 0)
79
+
80
+ rr.log("image/blurred", rr.Image(blur))
81
+
82
+ # Each time we yield bytes from the stream back to Gradio, they
83
+ # are incrementally sent to the viewer. Make sure to yield any time
84
+ # you want the user to be able to see progress.
85
+ yield stream.read()
86
+
87
+
88
+ # However, if you have a workflow that creates an RRD file instead, you can still send it
89
+ # directly to the viewer by simply returning the path to the RRD file.
90
+ #
91
+ # This may be helpful if you need to execute a helper tool written in C++ or Rust that can't
92
+ # be easily modified to stream data directly via Gradio.
93
+ #
94
+ # In this case you may want to clean up the RRD file after it's sent to the viewer so that you
95
+ # don't accumulate too many temporary files.
96
+ @rr.thread_local_stream("rerun_example_cube_rrd")
97
+ def create_cube_rrd(x, y, z, pending_cleanup):
98
+ cube = build_color_grid(int(x), int(y), int(z), twist=0)
99
+ rr.log("cube", rr.Points3D(cube.positions, colors=cube.colors, radii=0.5))
100
+
101
+ # We eventually want to clean up the RRD file after it's sent to the viewer, so tracking
102
+ # any pending files to be cleaned up when the state is deleted.
103
+ temp = tempfile.NamedTemporaryFile(prefix="cube_", suffix=".rrd", delete=False)
104
+ pending_cleanup.append(temp.name)
105
+
106
+ blueprint = rrb.Spatial3DView(origin="cube")
107
+ rr.save(temp.name, default_blueprint=blueprint)
108
+
109
+ # Just return the name of the file -- Gradio will convert it to a FileData object
110
+ # and send it to the viewer.
111
+ return temp.name
112
+
113
+
114
+ def cleanup_cube_rrds(pending_cleanup):
115
+ for f in pending_cleanup:
116
+ os.unlink(f)
117
+
118
+
119
+ with gr.Blocks() as demo:
120
+ with gr.Tab("Streaming"):
121
+ with gr.Row():
122
+ img = gr.Image(interactive=True, label="Image")
123
+ with gr.Column():
124
+ stream_blur = gr.Button("Stream Repeated Blur")
125
+
126
+ with gr.Tab("Dynamic RRD"):
127
+ pending_cleanup = gr.State(
128
+ [], time_to_live=10, delete_callback=cleanup_cube_rrds
129
+ )
130
+ with gr.Row():
131
+ x_count = gr.Number(
132
+ minimum=1, maximum=10, value=5, precision=0, label="X Count"
133
+ )
134
+ y_count = gr.Number(
135
+ minimum=1, maximum=10, value=5, precision=0, label="Y Count"
136
+ )
137
+ z_count = gr.Number(
138
+ minimum=1, maximum=10, value=5, precision=0, label="Z Count"
139
+ )
140
+ with gr.Row():
141
+ create_rrd = gr.Button("Create RRD")
142
+
143
+ with gr.Tab("Hosted RRD"):
144
+ with gr.Row():
145
+ # It may be helpful to point the viewer to a hosted RRD file on another server.
146
+ # If an RRD file is hosted via http, you can just return a URL to the file.
147
+ choose_rrd = gr.Dropdown(
148
+ label="RRD",
149
+ choices=[
150
+ f"{rr.bindings.get_app_url()}/examples/arkit_scenes.rrd",
151
+ f"{rr.bindings.get_app_url()}/examples/dna.rrd",
152
+ f"{rr.bindings.get_app_url()}/examples/plots.rrd",
153
+ ],
154
+ )
155
+
156
+ # Rerun 0.16 has issues when embedded in a Gradio tab, so we share a viewer between all the tabs.
157
+ # In 0.17 we can instead scope each viewer to its own tab to clean up these examples further.
158
  with gr.Row():
159
+ viewer = Rerun(
160
+ streaming=True,
161
+ )
162
+
163
+ stream_blur.click(streaming_repeated_blur, inputs=[img], outputs=[viewer])
164
+
165
+ create_rrd.click(
166
+ create_cube_rrd,
167
+ inputs=[x_count, y_count, z_count, pending_cleanup],
168
+ outputs=[viewer],
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
169
  )
170
 
171
+ choose_rrd.change(lambda x: x, inputs=[choose_rrd], outputs=[viewer])
172
+
173
+
174
  if __name__ == "__main__":
175
  demo.launch()
176
 
 
195
  <td align="left" style="width: 25%;">
196
 
197
  ```python
198
+ list[pathlib.Path | str]
199
+ | pathlib.Path
200
+ | str
201
+ | bytes
202
+ | Callable
203
+ | None
204
  ```
205
 
206
  </td>
207
  <td align="left"><code>None</code></td>
208
+ <td align="left">Takes a singular or list of RRD resources. Each RRD can be a Path, a string containing a url, or a binary blob containing encoded RRD data. If callable, the function will be called whenever the app loads to set the initial value of the component.</td>
209
  </tr>
210
 
211
  <tr>
 
247
  <td align="left">if True, will display label.</td>
248
  </tr>
249
 
 
 
 
 
 
 
 
 
 
 
 
 
 
250
  <tr>
251
  <td align="left"><code>container</code></td>
252
  <td align="left" style="width: 25%;">
 
300
  </tr>
301
 
302
  <tr>
303
+ <td align="left"><code>visible</code></td>
304
  <td align="left" style="width: 25%;">
305
 
306
  ```python
307
+ bool
308
  ```
309
 
310
  </td>
311
+ <td align="left"><code>True</code></td>
312
+ <td align="left">If False, component will be hidden.</td>
313
  </tr>
314
 
315
  <tr>
316
+ <td align="left"><code>streaming</code></td>
317
  <td align="left" style="width: 25%;">
318
 
319
  ```python
 
321
  ```
322
 
323
  </td>
324
+ <td align="left"><code>False</code></td>
325
+ <td align="left">If True, the data should be incrementally yielded from the source as `bytes` returned by calling `.read()` on an `rr.binary_stream()`</td>
326
  </tr>
327
 
328
  <tr>
 
366
  </tbody></table>
367
 
368
 
 
 
 
 
 
 
 
 
369
 
370
 
371
  ### User function
 
377
 
378
  The code snippet below is accurate in cases where the component is used as both an input and an output.
379
 
380
+ - **As output:** Is passed, a RerunData object.
381
+ - **As input:** Should return, expects.
382
 
383
  ```python
384
  def predict(
385
+ value: RerunData | None
386
+ ) -> list[pathlib.Path | str] | pathlib.Path | str | bytes:
 
 
 
387
  return value
388
  ```
389
 
390
+
391
+ ## `RerunData`
392
+ ```python
393
+ class RerunData(GradioRootModel):
394
+ root: list[FileData | str]
395
+ ```
src/backend/gradio_rerun/rerun.py CHANGED
@@ -3,73 +3,69 @@
3
  from __future__ import annotations
4
 
5
  from pathlib import Path
6
- from typing import Any
7
 
8
  from gradio_client import file
9
-
10
- from gradio.components.base import Component
11
  from gradio.data_classes import GradioRootModel, FileData
12
  from gradio.events import Events
13
 
14
 
15
  class RerunData(GradioRootModel):
16
  """
17
- Data model for Rerun component it can be a list of FileData, FileData, or as list of URLs.
 
 
18
  """
19
 
20
- root: list[FileData] | FileData | str | list[str]
21
 
22
 
23
- class Rerun(Component):
24
  """
25
- Creates an image component that can be used to upload images (as an input) or display images (as an output).
26
  """
27
 
28
- EVENTS = [
29
- Events.clear,
30
- Events.change,
31
- Events.upload,
32
- ]
33
 
34
  data_model = RerunData
35
 
36
  def __init__(
37
  self,
38
- value: list[str] | None = None,
39
  *,
40
  label: str | None = None,
41
  every: float | None = None,
42
  show_label: bool | None = None,
43
- show_download_button: bool = True,
44
  container: bool = True,
45
  scale: int | None = None,
46
  min_width: int = 160,
47
  height: int | str = 640,
48
- interactive: bool | None = None,
49
  visible: bool = True,
 
50
  elem_id: str | None = None,
51
  elem_classes: list[str] | str | None = None,
52
  render: bool = True,
53
  ):
54
  """
55
  Parameters:
56
- value: A path or URL for the default value that Rerun component is going to take. If callable, the function will be called whenever the app loads to set the initial value of the component.
57
  label: The label for this component. Appears above the component and is also used as the header if there are a table of examples for this component. If None and used in a `gr.Interface`, the label will be the name of the parameter this component is assigned to.
58
  every: If `value` is a callable, run the function 'every' number of seconds while the client connection is open. Has no effect otherwise. Queue must be enabled. The event can be accessed (e.g. to cancel it) via this component's .load_event attribute.
59
  show_label: if True, will display label.
60
- show_download_button: If True, will display button to download image.
61
  container: If True, will place the component in a container - providing some extra padding around the border.
62
  scale: relative size compared to adjacent Components. For example if Components A and B are in a Row, and A has scale=2, and B has scale=1, A will be twice as wide as B. Should be an integer. scale applies in Rows, and to top-level Components in Blocks where fill_height=True.
63
  min_width: minimum pixel width, will wrap if not sufficient screen space to satisfy this value. If a certain scale value results in this Component being narrower than min_width, the min_width parameter will be respected first.
64
  height: height of component in pixels. If a string is provided, will be interpreted as a CSS value. If None, will be set to 640px.
65
- interactive: if True, will allow users to upload and edit an image; if False, can only be used to display images. If not provided, this is inferred based on whether the component is used as an input or output.
66
  visible: If False, component will be hidden.
 
67
  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.
68
  elem_classes: An optional list of strings that are assigned as the classes of this component in the HTML DOM. Can be used for targeting CSS styles.
69
  render: If False, component will not render be rendered in the Blocks context. Should be used if the intention is to assign event listeners now but render the component later.
70
  """
71
- self.show_download_button = show_download_button
72
  self.height = height
 
73
  super().__init__(
74
  label=label,
75
  every=every,
@@ -77,7 +73,7 @@ class Rerun(Component):
77
  container=container,
78
  scale=scale,
79
  min_width=min_width,
80
- interactive=interactive,
81
  visible=visible,
82
  elem_id=elem_id,
83
  elem_classes=elem_classes,
@@ -85,39 +81,51 @@ class Rerun(Component):
85
  value=value,
86
  )
87
 
88
- def preprocess(self, payload: FileData | list[FileData] | None) -> str | None:
89
  """
 
 
90
  Parameters:
91
- payload: A FileData object containing the image data.
92
  Returns:
93
- A `str` containing the path to the image.
94
  """
95
  if payload is None:
96
  return None
97
  return payload
98
 
99
  def postprocess(
100
- self, value: list[FileData] | FileData | str | list[str]
101
- ) -> RerunData:
102
  """
103
  Parameters:
104
- value: Expects a `str` or `pathlib.Path` object containing the path to the image.
105
  Returns:
106
  A FileData object containing the image data.
107
  """
108
  if value is None:
109
  return RerunData(root=[])
110
 
 
 
 
 
 
 
 
 
111
  if not isinstance(value, list):
112
  value = [value]
113
 
114
- def is_url(input: str) -> bool:
 
 
115
  return input.startswith("http://") or input.startswith("https://")
116
 
117
  return RerunData(
118
  root=[
119
  FileData(
120
- path=file,
121
  orig_name=Path(file).name,
122
  size=Path(file).stat().st_size,
123
  )
@@ -127,18 +135,25 @@ class Rerun(Component):
127
  ]
128
  )
129
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
130
  def example_payload(self) -> Any:
131
- return [
132
- file(
133
- "https://app.rerun.io/version/0.15.1/examples/detect_and_track_objects.rrd"
134
- ),
135
- file(
136
- "https://app.rerun.io/version/0.15.1/examples/detect_and_track_objects.rrd"
137
- ),
138
- ]
139
 
140
  def example_value(self) -> Any:
141
  return [
142
- "https://app.rerun.io/version/0.15.1/examples/detect_and_track_objects.rrd",
143
- "https://app.rerun.io/version/0.15.1/examples/detect_and_track_objects.rrd",
144
  ]
 
3
  from __future__ import annotations
4
 
5
  from pathlib import Path
6
+ from typing import Any, Callable
7
 
8
  from gradio_client import file
9
+ from gradio import processing_utils
10
+ from gradio.components.base import Component, StreamingOutput
11
  from gradio.data_classes import GradioRootModel, FileData
12
  from gradio.events import Events
13
 
14
 
15
  class RerunData(GradioRootModel):
16
  """
17
+ Data model for Rerun component is a list of data sources.
18
+
19
+ `FileData` is used for data served from Gradio, while `str` is used for URLs Rerun will open from a remote server.
20
  """
21
 
22
+ root: list[FileData | str]
23
 
24
 
25
+ class Rerun(Component, StreamingOutput):
26
  """
27
+ Creates a Rerun viewer component that can be used to display the output of a Rerun stream.
28
  """
29
 
30
+ EVENTS: list[Events] = []
 
 
 
 
31
 
32
  data_model = RerunData
33
 
34
  def __init__(
35
  self,
36
+ value: list[Path | str] | Path | str | bytes | Callable | None = None,
37
  *,
38
  label: str | None = None,
39
  every: float | None = None,
40
  show_label: bool | None = None,
 
41
  container: bool = True,
42
  scale: int | None = None,
43
  min_width: int = 160,
44
  height: int | str = 640,
 
45
  visible: bool = True,
46
+ streaming: bool = False,
47
  elem_id: str | None = None,
48
  elem_classes: list[str] | str | None = None,
49
  render: bool = True,
50
  ):
51
  """
52
  Parameters:
53
+ value: Takes a singular or list of RRD resources. Each RRD can be a Path, a string containing a url, or a binary blob containing encoded RRD data. If callable, the function will be called whenever the app loads to set the initial value of the component.
54
  label: The label for this component. Appears above the component and is also used as the header if there are a table of examples for this component. If None and used in a `gr.Interface`, the label will be the name of the parameter this component is assigned to.
55
  every: If `value` is a callable, run the function 'every' number of seconds while the client connection is open. Has no effect otherwise. Queue must be enabled. The event can be accessed (e.g. to cancel it) via this component's .load_event attribute.
56
  show_label: if True, will display label.
 
57
  container: If True, will place the component in a container - providing some extra padding around the border.
58
  scale: relative size compared to adjacent Components. For example if Components A and B are in a Row, and A has scale=2, and B has scale=1, A will be twice as wide as B. Should be an integer. scale applies in Rows, and to top-level Components in Blocks where fill_height=True.
59
  min_width: minimum pixel width, will wrap if not sufficient screen space to satisfy this value. If a certain scale value results in this Component being narrower than min_width, the min_width parameter will be respected first.
60
  height: height of component in pixels. If a string is provided, will be interpreted as a CSS value. If None, will be set to 640px.
 
61
  visible: If False, component will be hidden.
62
+ streaming: If True, the data should be incrementally yielded from the source as `bytes` returned by calling `.read()` on an `rr.binary_stream()`
63
  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.
64
  elem_classes: An optional list of strings that are assigned as the classes of this component in the HTML DOM. Can be used for targeting CSS styles.
65
  render: If False, component will not render be rendered in the Blocks context. Should be used if the intention is to assign event listeners now but render the component later.
66
  """
 
67
  self.height = height
68
+ self.streaming = streaming
69
  super().__init__(
70
  label=label,
71
  every=every,
 
73
  container=container,
74
  scale=scale,
75
  min_width=min_width,
76
+ interactive=False, # Rerun is an output-component only
77
  visible=visible,
78
  elem_id=elem_id,
79
  elem_classes=elem_classes,
 
81
  value=value,
82
  )
83
 
84
+ def preprocess(self, payload: RerunData | None) -> RerunData | None:
85
  """
86
+ This component does not accept input.
87
+
88
  Parameters:
89
+ payload: A RerunData object.
90
  Returns:
91
+ A RerunData object.
92
  """
93
  if payload is None:
94
  return None
95
  return payload
96
 
97
  def postprocess(
98
+ self, value: list[Path | str] | Path | str | bytes
99
+ ) -> RerunData | bytes:
100
  """
101
  Parameters:
102
+ value: Expects
103
  Returns:
104
  A FileData object containing the image data.
105
  """
106
  if value is None:
107
  return RerunData(root=[])
108
 
109
+ if isinstance(value, bytes):
110
+ if self.streaming:
111
+ return value
112
+ file_path = processing_utils.save_bytes_to_cache(
113
+ value, "rrd", cache_dir=self.GRADIO_CACHE
114
+ )
115
+ return RerunData(root=[FileData(path=file_path)])
116
+
117
  if not isinstance(value, list):
118
  value = [value]
119
 
120
+ def is_url(input: Path | str) -> bool:
121
+ if isinstance(input, Path):
122
+ return False
123
  return input.startswith("http://") or input.startswith("https://")
124
 
125
  return RerunData(
126
  root=[
127
  FileData(
128
+ path=str(file),
129
  orig_name=Path(file).name,
130
  size=Path(file).stat().st_size,
131
  )
 
135
  ]
136
  )
137
 
138
+ def stream_output(
139
+ self, value, output_id: str, first_chunk: bool
140
+ ) -> tuple[bytes | None, Any]:
141
+ output_file = {
142
+ "path": output_id,
143
+ "is_stream": True,
144
+ }
145
+ if value is None:
146
+ return None, output_file
147
+ return value, output_file
148
+
149
+ def check_streamable(self):
150
+ return self.streaming
151
+
152
  def example_payload(self) -> Any:
153
+ return []
 
 
 
 
 
 
 
154
 
155
  def example_value(self) -> Any:
156
  return [
157
+ "https://app.rerun.io/version/0.16.0/examples/detect_and_track_objects.rrd",
158
+ "https://app.rerun.io/version/0.16.0/examples/dna.rrd",
159
  ]
src/backend/gradio_rerun/templates/component/index.js CHANGED
@@ -1,16 +1,16 @@
1
- let be = null;
2
  async function Bt() {
3
- return be || (be = (await import("./re_viewer-Ds4oCzjL.js")).WebHandle, be);
4
  }
5
  function Dt() {
6
- const n = new Uint8Array(16);
7
- return crypto.getRandomValues(n), Array.from(n).map((e) => e.toString(16).padStart(2, "0")).join("");
8
  }
9
  class Ht {
10
  /** @type {(import("./re_viewer.js").WebHandle) | null} */
11
  #e = null;
12
  /** @type {HTMLCanvasElement | null} */
13
- #l = null;
14
  /** @type {'ready' | 'starting' | 'stopped'} */
15
  #t = "stopped";
16
  /**
@@ -18,17 +18,24 @@ class Ht {
18
  *
19
  * @param {string | string[]} [rrd] URLs to `.rrd` files or WebSocket connections to our SDK.
20
  * @param {HTMLElement} [parent] The element to attach the canvas onto.
 
21
  * @returns {Promise<void>}
22
  */
23
- async start(e, t = document.body) {
24
  if (this.#t !== "stopped")
25
  return;
26
- this.#t = "starting", this.#l = document.createElement("canvas"), this.#l.id = Dt(), t.append(this.#l);
27
- let l = await Bt();
28
- if (this.#t === "starting" && (this.#e = new l(), await this.#e.start(this.#l.id, void 0), this.#t === "starting")) {
 
 
 
 
 
 
29
  if (this.#e.has_panicked())
30
  throw new Error(`Web viewer crashed: ${this.#e.panic_message()}`);
31
- e && this.open(e);
32
  }
33
  }
34
  /**
@@ -45,13 +52,16 @@ class Ht {
45
  * @see {WebViewer.start}
46
  *
47
  * @param {string | string[]} rrd URLs to `.rrd` files or WebSocket connections to our SDK.
 
 
 
48
  */
49
- open(e) {
50
  if (!this.#e)
51
  throw new Error(`attempted to open \`${e}\` in a stopped viewer`);
52
- const t = Array.isArray(e) ? e : [e];
53
- for (const l of t)
54
- if (this.#e.add_receiver(l), this.#e.has_panicked())
55
  throw new Error(`Web viewer crashed: ${this.#e.panic_message()}`);
56
  }
57
  /**
@@ -67,8 +77,8 @@ class Ht {
67
  if (!this.#e)
68
  throw new Error(`attempted to close \`${e}\` in a stopped viewer`);
69
  const t = Array.isArray(e) ? e : [e];
70
- for (const l of t)
71
- if (this.#e.remove_receiver(l), this.#e.has_panicked())
72
  throw new Error(`Web viewer crashed: ${this.#e.panic_message()}`);
73
  }
74
  /**
@@ -77,138 +87,199 @@ class Ht {
77
  * The same viewer instance may be started multiple times.
78
  */
79
  stop() {
80
- this.#t !== "stopped" && (this.#t = "stopped", this.#l?.remove(), this.#e?.destroy(), this.#e?.free(), this.#l = null, this.#e = null);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
81
  }
82
  }
83
  const {
84
  SvelteComponent: Tt,
85
- assign: Rt,
86
- create_slot: Xt,
87
- detach: Yt,
88
- element: Gt,
89
- get_all_dirty_from_scope: Ot,
90
- get_slot_changes: Ut,
91
- get_spread_update: Jt,
92
- init: Kt,
93
- insert: Qt,
94
- safe_not_equal: xt,
95
  set_dynamic_element_data: Pe,
96
  set_style: V,
97
  toggle_class: B,
98
  transition_in: dt,
99
  transition_out: mt,
100
- update_slot_base: $t
101
  } = window.__gradio__svelte__internal;
102
- function el(n) {
103
- let e, t, l;
104
  const i = (
105
  /*#slots*/
106
- n[18].default
107
- ), s = Xt(
108
  i,
109
- n,
110
  /*$$scope*/
111
- n[17],
112
  null
113
  );
114
  let o = [
115
  { "data-testid": (
116
  /*test_id*/
117
- n[7]
118
  ) },
119
  { id: (
120
  /*elem_id*/
121
- n[2]
122
  ) },
123
  {
124
  class: t = "block " + /*elem_classes*/
125
- n[3].join(" ") + " svelte-nl1om8"
126
  }
127
  ], a = {};
128
  for (let r = 0; r < o.length; r += 1)
129
- a = Rt(a, o[r]);
130
  return {
131
  c() {
132
- e = Gt(
133
  /*tag*/
134
- n[14]
135
  ), s && s.c(), Pe(
136
  /*tag*/
137
- n[14]
138
  )(e, a), B(
139
  e,
140
  "hidden",
141
  /*visible*/
142
- n[10] === !1
143
  ), B(
144
  e,
145
  "padded",
146
  /*padding*/
147
- n[6]
148
  ), B(
149
  e,
150
  "border_focus",
151
  /*border_mode*/
152
- n[5] === "focus"
153
  ), B(
154
  e,
155
  "border_contrast",
156
  /*border_mode*/
157
- n[5] === "contrast"
158
  ), B(e, "hide-container", !/*explicit_call*/
159
- n[8] && !/*container*/
160
- n[9]), V(
161
  e,
162
  "height",
163
  /*get_dimension*/
164
- n[15](
165
  /*height*/
166
- n[0]
167
  )
168
  ), V(e, "width", typeof /*width*/
169
- n[1] == "number" ? `calc(min(${/*width*/
170
- n[1]}px, 100%))` : (
171
  /*get_dimension*/
172
- n[15](
173
  /*width*/
174
- n[1]
175
  )
176
  )), V(
177
  e,
178
  "border-style",
179
  /*variant*/
180
- n[4]
181
  ), V(
182
  e,
183
  "overflow",
184
  /*allow_overflow*/
185
- n[11] ? "visible" : "hidden"
186
  ), V(
187
  e,
188
  "flex-grow",
189
  /*scale*/
190
- n[12]
191
  ), V(e, "min-width", `calc(min(${/*min_width*/
192
- n[13]}px, 100%))`), V(e, "border-width", "var(--block-border-width)");
193
  },
194
  m(r, f) {
195
- Qt(r, e, f), s && s.m(e, null), l = !0;
196
  },
197
  p(r, f) {
198
- s && s.p && (!l || f & /*$$scope*/
199
- 131072) && $t(
200
  s,
201
  i,
202
  r,
203
  /*$$scope*/
204
  r[17],
205
- l ? Ut(
206
  i,
207
  /*$$scope*/
208
  r[17],
209
  f,
210
  null
211
- ) : Ot(
212
  /*$$scope*/
213
  r[17]
214
  ),
@@ -216,18 +287,18 @@ function el(n) {
216
  ), Pe(
217
  /*tag*/
218
  r[14]
219
- )(e, a = Jt(o, [
220
- (!l || f & /*test_id*/
221
  128) && { "data-testid": (
222
  /*test_id*/
223
  r[7]
224
  ) },
225
- (!l || f & /*elem_id*/
226
  4) && { id: (
227
  /*elem_id*/
228
  r[2]
229
  ) },
230
- (!l || f & /*elem_classes*/
231
  8 && t !== (t = "block " + /*elem_classes*/
232
  r[3].join(" ") + " svelte-nl1om8")) && { class: t }
233
  ])), B(
@@ -293,55 +364,55 @@ function el(n) {
293
  r[13]}px, 100%))`);
294
  },
295
  i(r) {
296
- l || (dt(s, r), l = !0);
297
  },
298
  o(r) {
299
- mt(s, r), l = !1;
300
  },
301
  d(r) {
302
- r && Yt(e), s && s.d(r);
303
  }
304
  };
305
  }
306
- function tl(n) {
307
  let e, t = (
308
  /*tag*/
309
- n[14] && el(n)
310
  );
311
  return {
312
  c() {
313
  t && t.c();
314
  },
315
- m(l, i) {
316
- t && t.m(l, i), e = !0;
317
  },
318
- p(l, [i]) {
319
  /*tag*/
320
- l[14] && t.p(l, i);
321
  },
322
- i(l) {
323
- e || (dt(t, l), e = !0);
324
  },
325
- o(l) {
326
- mt(t, l), e = !1;
327
  },
328
- d(l) {
329
- t && t.d(l);
330
  }
331
  };
332
  }
333
- function ll(n, e, t) {
334
- let { $$slots: l = {}, $$scope: i } = e, { height: s = void 0 } = e, { width: o = void 0 } = e, { elem_id: a = "" } = e, { elem_classes: r = [] } = e, { variant: f = "solid" } = e, { border_mode: u = "base" } = e, { padding: _ = !0 } = e, { type: k = "normal" } = e, { test_id: m = void 0 } = e, { explicit_call: p = !1 } = e, { container: C = !0 } = e, { visible: y = !0 } = e, { allow_overflow: L = !0 } = e, { scale: d = null } = e, { min_width: c = 0 } = e, q = k === "fieldset" ? "fieldset" : "div";
335
- const z = (h) => {
336
- if (h !== void 0) {
337
- if (typeof h == "number")
338
- return h + "px";
339
- if (typeof h == "string")
340
- return h;
341
  }
342
  };
343
- return n.$$set = (h) => {
344
- "height" in h && t(0, s = h.height), "width" in h && t(1, o = h.width), "elem_id" in h && t(2, a = h.elem_id), "elem_classes" in h && t(3, r = h.elem_classes), "variant" in h && t(4, f = h.variant), "border_mode" in h && t(5, u = h.border_mode), "padding" in h && t(6, _ = h.padding), "type" in h && t(16, k = h.type), "test_id" in h && t(7, m = h.test_id), "explicit_call" in h && t(8, p = h.explicit_call), "container" in h && t(9, C = h.container), "visible" in h && t(10, y = h.visible), "allow_overflow" in h && t(11, L = h.allow_overflow), "scale" in h && t(12, d = h.scale), "min_width" in h && t(13, c = h.min_width), "$$scope" in h && t(17, i = h.$$scope);
345
  }, [
346
  s,
347
  o,
@@ -349,24 +420,24 @@ function ll(n, e, t) {
349
  r,
350
  f,
351
  u,
352
- _,
353
  m,
354
- p,
355
- C,
356
  y,
357
  L,
 
 
358
  d,
359
- c,
360
  q,
361
  z,
362
- k,
363
  i,
364
- l
365
  ];
366
  }
367
- class nl extends Tt {
368
  constructor(e) {
369
- super(), Kt(this, e, ll, tl, xt, {
370
  height: 0,
371
  width: 1,
372
  elem_id: 2,
@@ -386,195 +457,195 @@ class nl extends Tt {
386
  }
387
  }
388
  const {
389
- SvelteComponent: il,
390
  append: Se,
391
- attr: R,
392
- bubble: sl,
393
- create_component: fl,
394
- destroy_component: ol,
395
- detach: bt,
396
- element: Me,
397
- init: rl,
398
- insert: ht,
399
- listen: al,
400
- mount_component: ul,
401
- safe_not_equal: cl,
402
- set_data: _l,
403
  set_style: ee,
404
- space: dl,
405
- text: ml,
406
- toggle_class: S,
407
- transition_in: bl,
408
- transition_out: hl
409
  } = window.__gradio__svelte__internal;
410
- function We(n) {
411
  let e, t;
412
  return {
413
  c() {
414
- e = Me("span"), t = ml(
415
  /*label*/
416
- n[1]
417
- ), R(e, "class", "svelte-1lrphxw");
418
  },
419
- m(l, i) {
420
- ht(l, e, i), Se(e, t);
421
  },
422
- p(l, i) {
423
  i & /*label*/
424
- 2 && _l(
425
  t,
426
  /*label*/
427
- l[1]
428
  );
429
  },
430
- d(l) {
431
- l && bt(e);
432
  }
433
  };
434
  }
435
- function gl(n) {
436
- let e, t, l, i, s, o, a, r = (
437
  /*show_label*/
438
- n[2] && We(n)
439
  );
440
  return i = new /*Icon*/
441
- n[0]({}), {
442
  c() {
443
- e = Me("button"), r && r.c(), t = dl(), l = Me("div"), fl(i.$$.fragment), R(l, "class", "svelte-1lrphxw"), S(
444
- l,
445
  "small",
446
  /*size*/
447
- n[4] === "small"
448
- ), S(
449
- l,
450
  "large",
451
  /*size*/
452
- n[4] === "large"
453
- ), S(
454
- l,
455
  "medium",
456
  /*size*/
457
- n[4] === "medium"
458
  ), e.disabled = /*disabled*/
459
- n[7], R(
460
  e,
461
  "aria-label",
462
  /*label*/
463
- n[1]
464
- ), R(
465
  e,
466
  "aria-haspopup",
467
  /*hasPopup*/
468
- n[8]
469
- ), R(
470
  e,
471
  "title",
472
  /*label*/
473
- n[1]
474
- ), R(e, "class", "svelte-1lrphxw"), S(
475
  e,
476
  "pending",
477
  /*pending*/
478
- n[3]
479
- ), S(
480
  e,
481
  "padded",
482
  /*padded*/
483
- n[5]
484
- ), S(
485
  e,
486
  "highlight",
487
  /*highlight*/
488
- n[6]
489
- ), S(
490
  e,
491
  "transparent",
492
  /*transparent*/
493
- n[9]
494
  ), ee(e, "color", !/*disabled*/
495
- n[7] && /*_color*/
496
- n[12] ? (
497
  /*_color*/
498
- n[12]
499
  ) : "var(--block-label-text-color)"), ee(e, "--bg-color", /*disabled*/
500
- n[7] ? "auto" : (
501
  /*background*/
502
- n[10]
503
  )), ee(
504
  e,
505
  "margin-left",
506
  /*offset*/
507
- n[11] + "px"
508
  );
509
  },
510
  m(f, u) {
511
- ht(f, e, u), r && r.m(e, null), Se(e, t), Se(e, l), ul(i, l, null), s = !0, o || (a = al(
512
  e,
513
  "click",
514
  /*click_handler*/
515
- n[14]
516
  ), o = !0);
517
  },
518
  p(f, [u]) {
519
  /*show_label*/
520
  f[2] ? r ? r.p(f, u) : (r = We(f), r.c(), r.m(e, t)) : r && (r.d(1), r = null), (!s || u & /*size*/
521
- 16) && S(
522
- l,
523
  "small",
524
  /*size*/
525
  f[4] === "small"
526
  ), (!s || u & /*size*/
527
- 16) && S(
528
- l,
529
  "large",
530
  /*size*/
531
  f[4] === "large"
532
  ), (!s || u & /*size*/
533
- 16) && S(
534
- l,
535
  "medium",
536
  /*size*/
537
  f[4] === "medium"
538
  ), (!s || u & /*disabled*/
539
  128) && (e.disabled = /*disabled*/
540
  f[7]), (!s || u & /*label*/
541
- 2) && R(
542
  e,
543
  "aria-label",
544
  /*label*/
545
  f[1]
546
  ), (!s || u & /*hasPopup*/
547
- 256) && R(
548
  e,
549
  "aria-haspopup",
550
  /*hasPopup*/
551
  f[8]
552
  ), (!s || u & /*label*/
553
- 2) && R(
554
  e,
555
  "title",
556
  /*label*/
557
  f[1]
558
  ), (!s || u & /*pending*/
559
- 8) && S(
560
  e,
561
  "pending",
562
  /*pending*/
563
  f[3]
564
  ), (!s || u & /*padded*/
565
- 32) && S(
566
  e,
567
  "padded",
568
  /*padded*/
569
  f[5]
570
  ), (!s || u & /*highlight*/
571
- 64) && S(
572
  e,
573
  "highlight",
574
  /*highlight*/
575
  f[6]
576
  ), (!s || u & /*transparent*/
577
- 512) && S(
578
  e,
579
  "transparent",
580
  /*transparent*/
@@ -599,26 +670,26 @@ function gl(n) {
599
  );
600
  },
601
  i(f) {
602
- s || (bl(i.$$.fragment, f), s = !0);
603
  },
604
  o(f) {
605
- hl(i.$$.fragment, f), s = !1;
606
  },
607
  d(f) {
608
- f && bt(e), r && r.d(), ol(i), o = !1, a();
609
  }
610
  };
611
  }
612
- function wl(n, e, t) {
613
- let l, { Icon: i } = e, { label: s = "" } = e, { show_label: o = !1 } = e, { pending: a = !1 } = e, { size: r = "small" } = e, { padded: f = !0 } = e, { highlight: u = !1 } = e, { disabled: _ = !1 } = e, { hasPopup: k = !1 } = e, { color: m = "var(--block-label-text-color)" } = e, { transparent: p = !1 } = e, { background: C = "var(--background-fill-primary)" } = e, { offset: y = 0 } = e;
614
- function L(d) {
615
- sl.call(this, n, d);
616
  }
617
- return n.$$set = (d) => {
618
- "Icon" in d && t(0, i = d.Icon), "label" in d && t(1, s = d.label), "show_label" in d && t(2, o = d.show_label), "pending" in d && t(3, a = d.pending), "size" in d && t(4, r = d.size), "padded" in d && t(5, f = d.padded), "highlight" in d && t(6, u = d.highlight), "disabled" in d && t(7, _ = d.disabled), "hasPopup" in d && t(8, k = d.hasPopup), "color" in d && t(13, m = d.color), "transparent" in d && t(9, p = d.transparent), "background" in d && t(10, C = d.background), "offset" in d && t(11, y = d.offset);
619
- }, n.$$.update = () => {
620
- n.$$.dirty & /*highlight, color*/
621
- 8256 && t(12, l = u ? "var(--color-accent)" : m);
622
  }, [
623
  i,
624
  s,
@@ -627,19 +698,19 @@ function wl(n, e, t) {
627
  r,
628
  f,
629
  u,
630
- _,
631
- k,
632
  p,
633
- C,
634
  y,
635
- l,
 
 
636
  m,
637
- L
638
  ];
639
  }
640
- class kl extends il {
641
  constructor(e) {
642
- super(), rl(this, e, wl, gl, cl, {
643
  Icon: 0,
644
  label: 1,
645
  show_label: 2,
@@ -657,40 +728,40 @@ class kl extends il {
657
  }
658
  }
659
  const {
660
- SvelteComponent: pl,
661
  append: Ce,
662
- attr: E,
663
- detach: yl,
664
- init: vl,
665
- insert: ql,
666
  noop: Fe,
667
- safe_not_equal: Cl,
668
  set_style: D,
669
- svg_element: he
670
  } = window.__gradio__svelte__internal;
671
- function Fl(n) {
672
- let e, t, l, i;
673
  return {
674
  c() {
675
- e = he("svg"), t = he("g"), l = he("path"), i = he("path"), E(l, "d", "M18,6L6.087,17.913"), D(l, "fill", "none"), D(l, "fill-rule", "nonzero"), D(l, "stroke-width", "2px"), E(t, "transform", "matrix(1.14096,-0.140958,-0.140958,1.14096,-0.0559523,0.0559523)"), E(i, "d", "M4.364,4.364L19.636,19.636"), D(i, "fill", "none"), D(i, "fill-rule", "nonzero"), D(i, "stroke-width", "2px"), E(e, "width", "100%"), E(e, "height", "100%"), E(e, "viewBox", "0 0 24 24"), E(e, "version", "1.1"), E(e, "xmlns", "http://www.w3.org/2000/svg"), E(e, "xmlns:xlink", "http://www.w3.org/1999/xlink"), E(e, "xml:space", "preserve"), E(e, "stroke", "currentColor"), D(e, "fill-rule", "evenodd"), D(e, "clip-rule", "evenodd"), D(e, "stroke-linecap", "round"), D(e, "stroke-linejoin", "round");
676
  },
677
  m(s, o) {
678
- ql(s, e, o), Ce(e, t), Ce(t, l), Ce(e, i);
679
  },
680
  p: Fe,
681
  i: Fe,
682
  o: Fe,
683
  d(s) {
684
- s && yl(e);
685
  }
686
  };
687
  }
688
- class Ll extends pl {
689
  constructor(e) {
690
- super(), vl(this, e, null, Fl, Cl, {});
691
  }
692
  }
693
- const Sl = [
694
  { color: "red", primary: 600, secondary: 100 },
695
  { color: "green", primary: 600, secondary: 100 },
696
  { color: "blue", primary: 600, secondary: 100 },
@@ -994,41 +1065,41 @@ const Sl = [
994
  950: "#4c0519"
995
  }
996
  };
997
- Sl.reduce(
998
- (n, { color: e, primary: t, secondary: l }) => ({
999
- ...n,
1000
  [e]: {
1001
  primary: Be[e][t],
1002
- secondary: Be[e][l]
1003
  }
1004
  }),
1005
  {}
1006
  );
1007
- function ne(n) {
1008
  let e = ["", "k", "M", "G", "T", "P", "E", "Z"], t = 0;
1009
- for (; n > 1e3 && t < e.length - 1; )
1010
- n /= 1e3, t++;
1011
- let l = e[t];
1012
- return (Number.isInteger(n) ? n : n.toFixed(1)) + l;
1013
  }
1014
  function ke() {
1015
  }
1016
- function Ml(n, e) {
1017
- return n != n ? e == e : n !== e || n && typeof n == "object" || typeof n == "function";
1018
  }
1019
  const gt = typeof window < "u";
1020
- let De = gt ? () => window.performance.now() : () => Date.now(), wt = gt ? (n) => requestAnimationFrame(n) : ke;
1021
  const ie = /* @__PURE__ */ new Set();
1022
- function kt(n) {
1023
  ie.forEach((e) => {
1024
- e.c(n) || (ie.delete(e), e.f());
1025
  }), ie.size !== 0 && wt(kt);
1026
  }
1027
- function Vl(n) {
1028
  let e;
1029
  return ie.size === 0 && wt(kt), {
1030
  promise: new Promise((t) => {
1031
- ie.add(e = { c: n, f: t });
1032
  }),
1033
  abort() {
1034
  ie.delete(e);
@@ -1036,14 +1107,14 @@ function Vl(n) {
1036
  };
1037
  }
1038
  const te = [];
1039
- function zl(n, e = ke) {
1040
  let t;
1041
- const l = /* @__PURE__ */ new Set();
1042
  function i(a) {
1043
- if (Ml(n, a) && (n = a, t)) {
1044
  const r = !te.length;
1045
- for (const f of l)
1046
- f[1](), te.push(f, n);
1047
  if (r) {
1048
  for (let f = 0; f < te.length; f += 2)
1049
  te[f][0](te[f + 1]);
@@ -1052,445 +1123,445 @@ function zl(n, e = ke) {
1052
  }
1053
  }
1054
  function s(a) {
1055
- i(a(n));
1056
  }
1057
  function o(a, r = ke) {
1058
  const f = [a, r];
1059
- return l.add(f), l.size === 1 && (t = e(i, s) || ke), a(n), () => {
1060
- l.delete(f), l.size === 0 && t && (t(), t = null);
1061
  };
1062
  }
1063
  return { set: i, update: s, subscribe: o };
1064
  }
1065
- function He(n) {
1066
- return Object.prototype.toString.call(n) === "[object Date]";
1067
  }
1068
- function Ve(n, e, t, l) {
1069
  if (typeof t == "number" || He(t)) {
1070
- const i = l - t, s = (t - e) / (n.dt || 1 / 60), o = n.opts.stiffness * i, a = n.opts.damping * s, r = (o - a) * n.inv_mass, f = (s + r) * n.dt;
1071
- return Math.abs(f) < n.opts.precision && Math.abs(i) < n.opts.precision ? l : (n.settled = !1, He(t) ? new Date(t.getTime() + f) : t + f);
1072
  } else {
1073
  if (Array.isArray(t))
1074
  return t.map(
1075
- (i, s) => Ve(n, e[s], t[s], l[s])
1076
  );
1077
  if (typeof t == "object") {
1078
  const i = {};
1079
  for (const s in t)
1080
- i[s] = Ve(n, e[s], t[s], l[s]);
1081
  return i;
1082
  } else
1083
  throw new Error(`Cannot spring ${typeof t} values`);
1084
  }
1085
  }
1086
- function Te(n, e = {}) {
1087
- const t = zl(n), { stiffness: l = 0.15, damping: i = 0.8, precision: s = 0.01 } = e;
1088
- let o, a, r, f = n, u = n, _ = 1, k = 0, m = !1;
1089
- function p(y, L = {}) {
1090
- u = y;
1091
  const d = r = {};
1092
- return n == null || L.hard || C.stiffness >= 1 && C.damping >= 1 ? (m = !0, o = De(), f = y, t.set(n = u), Promise.resolve()) : (L.soft && (k = 1 / ((L.soft === !0 ? 0.5 : +L.soft) * 60), _ = 0), a || (o = De(), m = !1, a = Vl((c) => {
1093
  if (m)
1094
  return m = !1, a = null, !1;
1095
- _ = Math.min(_ + k, 1);
1096
  const q = {
1097
- inv_mass: _,
1098
- opts: C,
1099
  settled: !0,
1100
- dt: (c - o) * 60 / 1e3
1101
- }, z = Ve(q, f, n, u);
1102
- return o = c, f = n, t.set(n = z), q.settled && (a = null), !q.settled;
1103
- })), new Promise((c) => {
1104
  a.promise.then(() => {
1105
- d === r && c();
1106
  });
1107
  }));
1108
  }
1109
- const C = {
1110
- set: p,
1111
- update: (y, L) => p(y(u, n), L),
1112
  subscribe: t.subscribe,
1113
- stiffness: l,
1114
  damping: i,
1115
  precision: s
1116
  };
1117
- return C;
1118
  }
1119
  const {
1120
- SvelteComponent: Nl,
1121
  append: j,
1122
- attr: v,
1123
- component_subscribe: Re,
1124
- detach: Al,
1125
- element: El,
1126
- init: jl,
1127
- insert: Il,
1128
- noop: Xe,
1129
- safe_not_equal: Zl,
1130
  set_style: ge,
1131
- svg_element: I,
1132
- toggle_class: Ye
1133
- } = window.__gradio__svelte__internal, { onMount: Pl } = window.__gradio__svelte__internal;
1134
- function Wl(n) {
1135
- let e, t, l, i, s, o, a, r, f, u, _, k;
1136
  return {
1137
  c() {
1138
- e = El("div"), t = I("svg"), l = I("g"), i = I("path"), s = I("path"), o = I("path"), a = I("path"), r = I("g"), f = I("path"), u = I("path"), _ = I("path"), k = I("path"), v(i, "d", "M255.926 0.754768L509.702 139.936V221.027L255.926 81.8465V0.754768Z"), v(i, "fill", "#FF7C00"), v(i, "fill-opacity", "0.4"), v(i, "class", "svelte-43sxxs"), v(s, "d", "M509.69 139.936L254.981 279.641V361.255L509.69 221.55V139.936Z"), v(s, "fill", "#FF7C00"), v(s, "class", "svelte-43sxxs"), v(o, "d", "M0.250138 139.937L254.981 279.641V361.255L0.250138 221.55V139.937Z"), v(o, "fill", "#FF7C00"), v(o, "fill-opacity", "0.4"), v(o, "class", "svelte-43sxxs"), v(a, "d", "M255.923 0.232622L0.236328 139.936V221.55L255.923 81.8469V0.232622Z"), v(a, "fill", "#FF7C00"), v(a, "class", "svelte-43sxxs"), ge(l, "transform", "translate(" + /*$top*/
1139
- n[1][0] + "px, " + /*$top*/
1140
- n[1][1] + "px)"), v(f, "d", "M255.926 141.5L509.702 280.681V361.773L255.926 222.592V141.5Z"), v(f, "fill", "#FF7C00"), v(f, "fill-opacity", "0.4"), v(f, "class", "svelte-43sxxs"), v(u, "d", "M509.69 280.679L254.981 420.384V501.998L509.69 362.293V280.679Z"), v(u, "fill", "#FF7C00"), v(u, "class", "svelte-43sxxs"), v(_, "d", "M0.250138 280.681L254.981 420.386V502L0.250138 362.295V280.681Z"), v(_, "fill", "#FF7C00"), v(_, "fill-opacity", "0.4"), v(_, "class", "svelte-43sxxs"), v(k, "d", "M255.923 140.977L0.236328 280.68V362.294L255.923 222.591V140.977Z"), v(k, "fill", "#FF7C00"), v(k, "class", "svelte-43sxxs"), ge(r, "transform", "translate(" + /*$bottom*/
1141
- n[2][0] + "px, " + /*$bottom*/
1142
- n[2][1] + "px)"), v(t, "viewBox", "-1200 -1200 3000 3000"), v(t, "fill", "none"), v(t, "xmlns", "http://www.w3.org/2000/svg"), v(t, "class", "svelte-43sxxs"), v(e, "class", "svelte-43sxxs"), Ye(
1143
  e,
1144
  "margin",
1145
  /*margin*/
1146
- n[0]
1147
  );
1148
  },
1149
- m(m, p) {
1150
- Il(m, e, p), j(e, t), j(t, l), j(l, i), j(l, s), j(l, o), j(l, a), j(t, r), j(r, f), j(r, u), j(r, _), j(r, k);
1151
  },
1152
- p(m, [p]) {
1153
- p & /*$top*/
1154
- 2 && ge(l, "transform", "translate(" + /*$top*/
1155
  m[1][0] + "px, " + /*$top*/
1156
- m[1][1] + "px)"), p & /*$bottom*/
1157
  4 && ge(r, "transform", "translate(" + /*$bottom*/
1158
  m[2][0] + "px, " + /*$bottom*/
1159
- m[2][1] + "px)"), p & /*margin*/
1160
- 1 && Ye(
1161
  e,
1162
  "margin",
1163
  /*margin*/
1164
  m[0]
1165
  );
1166
  },
1167
- i: Xe,
1168
- o: Xe,
1169
  d(m) {
1170
- m && Al(e);
1171
  }
1172
  };
1173
  }
1174
- function Bl(n, e, t) {
1175
- let l, i;
1176
- var s = this && this.__awaiter || function(m, p, C, y) {
1177
- function L(d) {
1178
- return d instanceof C ? d : new C(function(c) {
1179
- c(d);
1180
  });
1181
  }
1182
- return new (C || (C = Promise))(function(d, c) {
1183
- function q(M) {
1184
  try {
1185
- h(y.next(M));
1186
- } catch (T) {
1187
- c(T);
1188
  }
1189
  }
1190
- function z(M) {
1191
  try {
1192
- h(y.throw(M));
1193
- } catch (T) {
1194
- c(T);
1195
  }
1196
  }
1197
- function h(M) {
1198
- M.done ? d(M.value) : L(M.value).then(q, z);
1199
  }
1200
- h((y = y.apply(m, p || [])).next());
1201
  });
1202
  };
1203
  let { margin: o = !0 } = e;
1204
- const a = Te([0, 0]);
1205
- Re(n, a, (m) => t(1, l = m));
1206
- const r = Te([0, 0]);
1207
- Re(n, r, (m) => t(2, i = m));
1208
  let f;
1209
  function u() {
1210
  return s(this, void 0, void 0, function* () {
1211
  yield Promise.all([a.set([125, 140]), r.set([-125, -140])]), yield Promise.all([a.set([-125, 140]), r.set([125, -140])]), yield Promise.all([a.set([-125, 0]), r.set([125, -0])]), yield Promise.all([a.set([125, 0]), r.set([-125, 0])]);
1212
  });
1213
  }
1214
- function _() {
1215
  return s(this, void 0, void 0, function* () {
1216
- yield u(), f || _();
1217
  });
1218
  }
1219
- function k() {
1220
  return s(this, void 0, void 0, function* () {
1221
- yield Promise.all([a.set([125, 0]), r.set([-125, 0])]), _();
1222
  });
1223
  }
1224
- return Pl(() => (k(), () => f = !0)), n.$$set = (m) => {
1225
  "margin" in m && t(0, o = m.margin);
1226
- }, [o, l, i, a, r];
1227
  }
1228
- class Dl extends Nl {
1229
  constructor(e) {
1230
- super(), jl(this, e, Bl, Wl, Zl, { margin: 0 });
1231
  }
1232
  }
1233
  const {
1234
- SvelteComponent: Hl,
1235
- append: J,
1236
  attr: P,
1237
- binding_callbacks: Ge,
1238
  check_outros: pt,
1239
  create_component: yt,
1240
- create_slot: Tl,
1241
  destroy_component: vt,
1242
  destroy_each: qt,
1243
- detach: g,
1244
  element: H,
1245
  empty: se,
1246
  ensure_array_like: pe,
1247
- get_all_dirty_from_scope: Rl,
1248
- get_slot_changes: Xl,
1249
  group_outros: Ct,
1250
- init: Yl,
1251
- insert: w,
1252
  mount_component: Ft,
1253
- noop: ze,
1254
- safe_not_equal: Gl,
1255
  set_data: A,
1256
- set_style: Y,
1257
  space: W,
1258
- text: F,
1259
- toggle_class: N,
1260
  transition_in: K,
1261
  transition_out: Q,
1262
- update_slot_base: Ol
1263
- } = window.__gradio__svelte__internal, { tick: Ul } = window.__gradio__svelte__internal, { onDestroy: Jl } = window.__gradio__svelte__internal, { createEventDispatcher: Kl } = window.__gradio__svelte__internal, Ql = (n) => ({}), Oe = (n) => ({});
1264
- function Ue(n, e, t) {
1265
- const l = n.slice();
1266
- return l[41] = e[t], l[43] = t, l;
1267
  }
1268
- function Je(n, e, t) {
1269
- const l = n.slice();
1270
- return l[41] = e[t], l;
1271
  }
1272
- function xl(n) {
1273
- let e, t, l, i, s = (
1274
  /*i18n*/
1275
- n[1]("common.error") + ""
1276
  ), o, a, r;
1277
- t = new kl({
1278
  props: {
1279
- Icon: Ll,
1280
  label: (
1281
  /*i18n*/
1282
- n[1]("common.clear")
1283
  ),
1284
  disabled: !1
1285
  }
1286
  }), t.$on(
1287
  "click",
1288
  /*click_handler*/
1289
- n[32]
1290
  );
1291
  const f = (
1292
  /*#slots*/
1293
- n[30].error
1294
- ), u = Tl(
1295
  f,
1296
- n,
1297
  /*$$scope*/
1298
- n[29],
1299
- Oe
1300
  );
1301
  return {
1302
  c() {
1303
- e = H("div"), yt(t.$$.fragment), l = W(), i = H("span"), o = F(s), a = W(), u && u.c(), P(e, "class", "clear-status svelte-1yk38uw"), P(i, "class", "error svelte-1yk38uw");
1304
  },
1305
- m(_, k) {
1306
- w(_, e, k), Ft(t, e, null), w(_, l, k), w(_, i, k), J(i, o), w(_, a, k), u && u.m(_, k), r = !0;
1307
  },
1308
- p(_, k) {
1309
  const m = {};
1310
- k[0] & /*i18n*/
1311
  2 && (m.label = /*i18n*/
1312
- _[1]("common.clear")), t.$set(m), (!r || k[0] & /*i18n*/
1313
  2) && s !== (s = /*i18n*/
1314
- _[1]("common.error") + "") && A(o, s), u && u.p && (!r || k[0] & /*$$scope*/
1315
- 536870912) && Ol(
1316
  u,
1317
  f,
1318
- _,
1319
  /*$$scope*/
1320
- _[29],
1321
- r ? Xl(
1322
  f,
1323
  /*$$scope*/
1324
- _[29],
1325
- k,
1326
- Ql
1327
- ) : Rl(
1328
  /*$$scope*/
1329
- _[29]
1330
  ),
1331
- Oe
1332
  );
1333
  },
1334
- i(_) {
1335
- r || (K(t.$$.fragment, _), K(u, _), r = !0);
1336
  },
1337
- o(_) {
1338
- Q(t.$$.fragment, _), Q(u, _), r = !1;
1339
  },
1340
- d(_) {
1341
- _ && (g(e), g(l), g(i), g(a)), vt(t), u && u.d(_);
1342
  }
1343
  };
1344
  }
1345
- function $l(n) {
1346
- let e, t, l, i, s, o, a, r, f, u = (
1347
  /*variant*/
1348
- n[8] === "default" && /*show_eta_bar*/
1349
- n[18] && /*show_progress*/
1350
- n[6] === "full" && Ke(n)
1351
  );
1352
- function _(c, q) {
1353
  if (
1354
  /*progress*/
1355
- c[7]
1356
  )
1357
- return ln;
1358
  if (
1359
  /*queue_position*/
1360
- c[2] !== null && /*queue_size*/
1361
- c[3] !== void 0 && /*queue_position*/
1362
- c[2] >= 0
1363
  )
1364
- return tn;
1365
  if (
1366
  /*queue_position*/
1367
- c[2] === 0
1368
  )
1369
- return en;
1370
  }
1371
- let k = _(n), m = k && k(n), p = (
1372
  /*timer*/
1373
- n[5] && $e(n)
1374
  );
1375
- const C = [on, fn], y = [];
1376
- function L(c, q) {
1377
  return (
1378
  /*last_progress_level*/
1379
- c[15] != null ? 0 : (
1380
  /*show_progress*/
1381
- c[6] === "full" ? 1 : -1
1382
  )
1383
  );
1384
  }
1385
- ~(s = L(n)) && (o = y[s] = C[s](n));
1386
  let d = !/*timer*/
1387
- n[5] && ft(n);
1388
  return {
1389
  c() {
1390
- u && u.c(), e = W(), t = H("div"), m && m.c(), l = W(), p && p.c(), i = W(), o && o.c(), a = W(), d && d.c(), r = se(), P(t, "class", "progress-text svelte-1yk38uw"), N(
1391
  t,
1392
  "meta-text-center",
1393
  /*variant*/
1394
- n[8] === "center"
1395
- ), N(
1396
  t,
1397
  "meta-text",
1398
  /*variant*/
1399
- n[8] === "default"
1400
  );
1401
  },
1402
- m(c, q) {
1403
- u && u.m(c, q), w(c, e, q), w(c, t, q), m && m.m(t, null), J(t, l), p && p.m(t, null), w(c, i, q), ~s && y[s].m(c, q), w(c, a, q), d && d.m(c, q), w(c, r, q), f = !0;
1404
  },
1405
- p(c, q) {
1406
  /*variant*/
1407
- c[8] === "default" && /*show_eta_bar*/
1408
- c[18] && /*show_progress*/
1409
- c[6] === "full" ? u ? u.p(c, q) : (u = Ke(c), u.c(), u.m(e.parentNode, e)) : u && (u.d(1), u = null), k === (k = _(c)) && m ? m.p(c, q) : (m && m.d(1), m = k && k(c), m && (m.c(), m.m(t, l))), /*timer*/
1410
- c[5] ? p ? p.p(c, q) : (p = $e(c), p.c(), p.m(t, null)) : p && (p.d(1), p = null), (!f || q[0] & /*variant*/
1411
- 256) && N(
1412
  t,
1413
  "meta-text-center",
1414
  /*variant*/
1415
- c[8] === "center"
1416
  ), (!f || q[0] & /*variant*/
1417
- 256) && N(
1418
  t,
1419
  "meta-text",
1420
  /*variant*/
1421
- c[8] === "default"
1422
  );
1423
  let z = s;
1424
- s = L(c), s === z ? ~s && y[s].p(c, q) : (o && (Ct(), Q(y[z], 1, 1, () => {
1425
- y[z] = null;
1426
- }), pt()), ~s ? (o = y[s], o ? o.p(c, q) : (o = y[s] = C[s](c), o.c()), K(o, 1), o.m(a.parentNode, a)) : o = null), /*timer*/
1427
- c[5] ? d && (d.d(1), d = null) : d ? d.p(c, q) : (d = ft(c), d.c(), d.m(r.parentNode, r));
1428
  },
1429
- i(c) {
1430
  f || (K(o), f = !0);
1431
  },
1432
- o(c) {
1433
  Q(o), f = !1;
1434
  },
1435
- d(c) {
1436
- c && (g(e), g(t), g(i), g(a), g(r)), u && u.d(c), m && m.d(), p && p.d(), ~s && y[s].d(c), d && d.d(c);
1437
  }
1438
  };
1439
  }
1440
- function Ke(n) {
1441
  let e, t = `translateX(${/*eta_level*/
1442
- (n[17] || 0) * 100 - 100}%)`;
1443
  return {
1444
  c() {
1445
- e = H("div"), P(e, "class", "eta-bar svelte-1yk38uw"), Y(e, "transform", t);
1446
  },
1447
- m(l, i) {
1448
- w(l, e, i);
1449
  },
1450
- p(l, i) {
1451
  i[0] & /*eta_level*/
1452
  131072 && t !== (t = `translateX(${/*eta_level*/
1453
- (l[17] || 0) * 100 - 100}%)`) && Y(e, "transform", t);
1454
  },
1455
- d(l) {
1456
- l && g(e);
1457
  }
1458
  };
1459
  }
1460
- function en(n) {
1461
  let e;
1462
  return {
1463
  c() {
1464
- e = F("processing |");
1465
  },
1466
- m(t, l) {
1467
- w(t, e, l);
1468
  },
1469
- p: ze,
1470
  d(t) {
1471
- t && g(e);
1472
  }
1473
  };
1474
  }
1475
- function tn(n) {
1476
  let e, t = (
1477
  /*queue_position*/
1478
- n[2] + 1 + ""
1479
- ), l, i, s, o;
1480
  return {
1481
  c() {
1482
- e = F("queue: "), l = F(t), i = F("/"), s = F(
1483
  /*queue_size*/
1484
- n[3]
1485
- ), o = F(" |");
1486
  },
1487
  m(a, r) {
1488
- w(a, e, r), w(a, l, r), w(a, i, r), w(a, s, r), w(a, o, r);
1489
  },
1490
  p(a, r) {
1491
  r[0] & /*queue_position*/
1492
  4 && t !== (t = /*queue_position*/
1493
- a[2] + 1 + "") && A(l, t), r[0] & /*queue_size*/
1494
  8 && A(
1495
  s,
1496
  /*queue_size*/
@@ -1498,27 +1569,27 @@ function tn(n) {
1498
  );
1499
  },
1500
  d(a) {
1501
- a && (g(e), g(l), g(i), g(s), g(o));
1502
  }
1503
  };
1504
  }
1505
- function ln(n) {
1506
  let e, t = pe(
1507
  /*progress*/
1508
- n[7]
1509
- ), l = [];
1510
  for (let i = 0; i < t.length; i += 1)
1511
- l[i] = xe(Je(n, t, i));
1512
  return {
1513
  c() {
1514
- for (let i = 0; i < l.length; i += 1)
1515
- l[i].c();
1516
  e = se();
1517
  },
1518
  m(i, s) {
1519
- for (let o = 0; o < l.length; o += 1)
1520
- l[o] && l[o].m(i, s);
1521
- w(i, e, s);
1522
  },
1523
  p(i, s) {
1524
  if (s[0] & /*progress*/
@@ -1529,139 +1600,139 @@ function ln(n) {
1529
  );
1530
  let o;
1531
  for (o = 0; o < t.length; o += 1) {
1532
- const a = Je(i, t, o);
1533
- l[o] ? l[o].p(a, s) : (l[o] = xe(a), l[o].c(), l[o].m(e.parentNode, e));
1534
  }
1535
- for (; o < l.length; o += 1)
1536
- l[o].d(1);
1537
- l.length = t.length;
1538
  }
1539
  },
1540
  d(i) {
1541
- i && g(e), qt(l, i);
1542
  }
1543
  };
1544
  }
1545
- function Qe(n) {
1546
  let e, t = (
1547
  /*p*/
1548
- n[41].unit + ""
1549
- ), l, i, s = " ", o;
1550
- function a(u, _) {
1551
  return (
1552
  /*p*/
1553
- u[41].length != null ? sn : nn
1554
  );
1555
  }
1556
- let r = a(n), f = r(n);
1557
  return {
1558
  c() {
1559
- f.c(), e = W(), l = F(t), i = F(" | "), o = F(s);
1560
  },
1561
- m(u, _) {
1562
- f.m(u, _), w(u, e, _), w(u, l, _), w(u, i, _), w(u, o, _);
1563
  },
1564
- p(u, _) {
1565
- r === (r = a(u)) && f ? f.p(u, _) : (f.d(1), f = r(u), f && (f.c(), f.m(e.parentNode, e))), _[0] & /*progress*/
1566
  128 && t !== (t = /*p*/
1567
- u[41].unit + "") && A(l, t);
1568
  },
1569
  d(u) {
1570
- u && (g(e), g(l), g(i), g(o)), f.d(u);
1571
  }
1572
  };
1573
  }
1574
- function nn(n) {
1575
- let e = ne(
1576
  /*p*/
1577
- n[41].index || 0
1578
  ) + "", t;
1579
  return {
1580
  c() {
1581
- t = F(e);
1582
  },
1583
- m(l, i) {
1584
- w(l, t, i);
1585
  },
1586
- p(l, i) {
1587
  i[0] & /*progress*/
1588
- 128 && e !== (e = ne(
1589
  /*p*/
1590
- l[41].index || 0
1591
  ) + "") && A(t, e);
1592
  },
1593
- d(l) {
1594
- l && g(t);
1595
  }
1596
  };
1597
  }
1598
- function sn(n) {
1599
- let e = ne(
1600
  /*p*/
1601
- n[41].index || 0
1602
- ) + "", t, l, i = ne(
1603
  /*p*/
1604
- n[41].length
1605
  ) + "", s;
1606
  return {
1607
  c() {
1608
- t = F(e), l = F("/"), s = F(i);
1609
  },
1610
  m(o, a) {
1611
- w(o, t, a), w(o, l, a), w(o, s, a);
1612
  },
1613
  p(o, a) {
1614
  a[0] & /*progress*/
1615
- 128 && e !== (e = ne(
1616
  /*p*/
1617
  o[41].index || 0
1618
  ) + "") && A(t, e), a[0] & /*progress*/
1619
- 128 && i !== (i = ne(
1620
  /*p*/
1621
  o[41].length
1622
  ) + "") && A(s, i);
1623
  },
1624
  d(o) {
1625
- o && (g(t), g(l), g(s));
1626
  }
1627
  };
1628
  }
1629
- function xe(n) {
1630
  let e, t = (
1631
  /*p*/
1632
- n[41].index != null && Qe(n)
1633
  );
1634
  return {
1635
  c() {
1636
  t && t.c(), e = se();
1637
  },
1638
- m(l, i) {
1639
- t && t.m(l, i), w(l, e, i);
1640
  },
1641
- p(l, i) {
1642
  /*p*/
1643
- l[41].index != null ? t ? t.p(l, i) : (t = Qe(l), t.c(), t.m(e.parentNode, e)) : t && (t.d(1), t = null);
1644
  },
1645
- d(l) {
1646
- l && g(e), t && t.d(l);
1647
  }
1648
  };
1649
  }
1650
- function $e(n) {
1651
  let e, t = (
1652
  /*eta*/
1653
- n[0] ? `/${/*formatted_eta*/
1654
- n[19]}` : ""
1655
- ), l, i;
1656
  return {
1657
  c() {
1658
- e = F(
1659
  /*formatted_timer*/
1660
- n[20]
1661
- ), l = F(t), i = F("s");
1662
  },
1663
  m(s, o) {
1664
- w(s, e, o), w(s, l, o), w(s, i, o);
1665
  },
1666
  p(s, o) {
1667
  o[0] & /*formatted_timer*/
@@ -1672,87 +1743,87 @@ function $e(n) {
1672
  ), o[0] & /*eta, formatted_eta*/
1673
  524289 && t !== (t = /*eta*/
1674
  s[0] ? `/${/*formatted_eta*/
1675
- s[19]}` : "") && A(l, t);
1676
  },
1677
  d(s) {
1678
- s && (g(e), g(l), g(i));
1679
  }
1680
  };
1681
  }
1682
- function fn(n) {
1683
  let e, t;
1684
- return e = new Dl({
1685
  props: { margin: (
1686
  /*variant*/
1687
- n[8] === "default"
1688
  ) }
1689
  }), {
1690
  c() {
1691
  yt(e.$$.fragment);
1692
  },
1693
- m(l, i) {
1694
- Ft(e, l, i), t = !0;
1695
  },
1696
- p(l, i) {
1697
  const s = {};
1698
  i[0] & /*variant*/
1699
  256 && (s.margin = /*variant*/
1700
- l[8] === "default"), e.$set(s);
1701
  },
1702
- i(l) {
1703
- t || (K(e.$$.fragment, l), t = !0);
1704
  },
1705
- o(l) {
1706
- Q(e.$$.fragment, l), t = !1;
1707
  },
1708
- d(l) {
1709
- vt(e, l);
1710
  }
1711
  };
1712
  }
1713
- function on(n) {
1714
- let e, t, l, i, s, o = `${/*last_progress_level*/
1715
- n[15] * 100}%`, a = (
1716
  /*progress*/
1717
- n[7] != null && et(n)
1718
  );
1719
  return {
1720
  c() {
1721
- e = H("div"), t = H("div"), a && a.c(), l = W(), i = H("div"), s = H("div"), P(t, "class", "progress-level-inner svelte-1yk38uw"), P(s, "class", "progress-bar svelte-1yk38uw"), Y(s, "width", o), P(i, "class", "progress-bar-wrap svelte-1yk38uw"), P(e, "class", "progress-level svelte-1yk38uw");
1722
  },
1723
  m(r, f) {
1724
- w(r, e, f), J(e, t), a && a.m(t, null), J(e, l), J(e, i), J(i, s), n[31](s);
1725
  },
1726
  p(r, f) {
1727
  /*progress*/
1728
  r[7] != null ? a ? a.p(r, f) : (a = et(r), a.c(), a.m(t, null)) : a && (a.d(1), a = null), f[0] & /*last_progress_level*/
1729
  32768 && o !== (o = `${/*last_progress_level*/
1730
- r[15] * 100}%`) && Y(s, "width", o);
1731
  },
1732
- i: ze,
1733
- o: ze,
1734
  d(r) {
1735
- r && g(e), a && a.d(), n[31](null);
1736
  }
1737
  };
1738
  }
1739
- function et(n) {
1740
  let e, t = pe(
1741
  /*progress*/
1742
- n[7]
1743
- ), l = [];
1744
  for (let i = 0; i < t.length; i += 1)
1745
- l[i] = st(Ue(n, t, i));
1746
  return {
1747
  c() {
1748
- for (let i = 0; i < l.length; i += 1)
1749
- l[i].c();
1750
  e = se();
1751
  },
1752
  m(i, s) {
1753
- for (let o = 0; o < l.length; o += 1)
1754
- l[o] && l[o].m(i, s);
1755
- w(i, e, s);
1756
  },
1757
  p(i, s) {
1758
  if (s[0] & /*progress_level, progress*/
@@ -1763,123 +1834,123 @@ function et(n) {
1763
  );
1764
  let o;
1765
  for (o = 0; o < t.length; o += 1) {
1766
- const a = Ue(i, t, o);
1767
- l[o] ? l[o].p(a, s) : (l[o] = st(a), l[o].c(), l[o].m(e.parentNode, e));
1768
  }
1769
- for (; o < l.length; o += 1)
1770
- l[o].d(1);
1771
- l.length = t.length;
1772
  }
1773
  },
1774
  d(i) {
1775
- i && g(e), qt(l, i);
1776
  }
1777
  };
1778
  }
1779
- function tt(n) {
1780
- let e, t, l, i, s = (
1781
  /*i*/
1782
- n[43] !== 0 && rn()
1783
  ), o = (
1784
  /*p*/
1785
- n[41].desc != null && lt(n)
1786
  ), a = (
1787
  /*p*/
1788
- n[41].desc != null && /*progress_level*/
1789
- n[14] && /*progress_level*/
1790
- n[14][
1791
  /*i*/
1792
- n[43]
1793
- ] != null && nt()
1794
  ), r = (
1795
  /*progress_level*/
1796
- n[14] != null && it(n)
1797
  );
1798
  return {
1799
  c() {
1800
- s && s.c(), e = W(), o && o.c(), t = W(), a && a.c(), l = W(), r && r.c(), i = se();
1801
  },
1802
  m(f, u) {
1803
- s && s.m(f, u), w(f, e, u), o && o.m(f, u), w(f, t, u), a && a.m(f, u), w(f, l, u), r && r.m(f, u), w(f, i, u);
1804
  },
1805
  p(f, u) {
1806
  /*p*/
1807
- f[41].desc != null ? o ? o.p(f, u) : (o = lt(f), o.c(), o.m(t.parentNode, t)) : o && (o.d(1), o = null), /*p*/
1808
  f[41].desc != null && /*progress_level*/
1809
  f[14] && /*progress_level*/
1810
  f[14][
1811
  /*i*/
1812
  f[43]
1813
- ] != null ? a || (a = nt(), a.c(), a.m(l.parentNode, l)) : a && (a.d(1), a = null), /*progress_level*/
1814
  f[14] != null ? r ? r.p(f, u) : (r = it(f), r.c(), r.m(i.parentNode, i)) : r && (r.d(1), r = null);
1815
  },
1816
  d(f) {
1817
- f && (g(e), g(t), g(l), g(i)), s && s.d(f), o && o.d(f), a && a.d(f), r && r.d(f);
1818
  }
1819
  };
1820
  }
1821
- function rn(n) {
1822
  let e;
1823
  return {
1824
  c() {
1825
- e = F(" /");
1826
  },
1827
- m(t, l) {
1828
- w(t, e, l);
1829
  },
1830
  d(t) {
1831
- t && g(e);
1832
  }
1833
  };
1834
  }
1835
- function lt(n) {
1836
  let e = (
1837
  /*p*/
1838
- n[41].desc + ""
1839
  ), t;
1840
  return {
1841
  c() {
1842
- t = F(e);
1843
  },
1844
- m(l, i) {
1845
- w(l, t, i);
1846
  },
1847
- p(l, i) {
1848
  i[0] & /*progress*/
1849
  128 && e !== (e = /*p*/
1850
- l[41].desc + "") && A(t, e);
1851
  },
1852
- d(l) {
1853
- l && g(t);
1854
  }
1855
  };
1856
  }
1857
- function nt(n) {
1858
  let e;
1859
  return {
1860
  c() {
1861
- e = F("-");
1862
  },
1863
- m(t, l) {
1864
- w(t, e, l);
1865
  },
1866
  d(t) {
1867
- t && g(e);
1868
  }
1869
  };
1870
  }
1871
- function it(n) {
1872
  let e = (100 * /*progress_level*/
1873
- (n[14][
1874
  /*i*/
1875
- n[43]
1876
- ] || 0)).toFixed(1) + "", t, l;
1877
  return {
1878
  c() {
1879
- t = F(e), l = F("%");
1880
  },
1881
  m(i, s) {
1882
- w(i, t, s), w(i, l, s);
1883
  },
1884
  p(i, s) {
1885
  s[0] & /*progress_level*/
@@ -1890,69 +1961,69 @@ function it(n) {
1890
  ] || 0)).toFixed(1) + "") && A(t, e);
1891
  },
1892
  d(i) {
1893
- i && (g(t), g(l));
1894
  }
1895
  };
1896
  }
1897
- function st(n) {
1898
  let e, t = (
1899
  /*p*/
1900
- (n[41].desc != null || /*progress_level*/
1901
- n[14] && /*progress_level*/
1902
- n[14][
1903
  /*i*/
1904
- n[43]
1905
- ] != null) && tt(n)
1906
  );
1907
  return {
1908
  c() {
1909
  t && t.c(), e = se();
1910
  },
1911
- m(l, i) {
1912
- t && t.m(l, i), w(l, e, i);
1913
  },
1914
- p(l, i) {
1915
  /*p*/
1916
- l[41].desc != null || /*progress_level*/
1917
- l[14] && /*progress_level*/
1918
- l[14][
1919
  /*i*/
1920
- l[43]
1921
- ] != null ? t ? t.p(l, i) : (t = tt(l), t.c(), t.m(e.parentNode, e)) : t && (t.d(1), t = null);
1922
  },
1923
- d(l) {
1924
- l && g(e), t && t.d(l);
1925
  }
1926
  };
1927
  }
1928
- function ft(n) {
1929
  let e, t;
1930
  return {
1931
  c() {
1932
- e = H("p"), t = F(
1933
  /*loading_text*/
1934
- n[9]
1935
  ), P(e, "class", "loading svelte-1yk38uw");
1936
  },
1937
- m(l, i) {
1938
- w(l, e, i), J(e, t);
1939
  },
1940
- p(l, i) {
1941
  i[0] & /*loading_text*/
1942
  512 && A(
1943
  t,
1944
  /*loading_text*/
1945
- l[9]
1946
  );
1947
  },
1948
- d(l) {
1949
- l && g(e);
1950
  }
1951
  };
1952
  }
1953
- function an(n) {
1954
- let e, t, l, i, s;
1955
- const o = [$l, xl], a = [];
1956
  function r(f, u) {
1957
  return (
1958
  /*status*/
@@ -1962,60 +2033,60 @@ function an(n) {
1962
  )
1963
  );
1964
  }
1965
- return ~(t = r(n)) && (l = a[t] = o[t](n)), {
1966
  c() {
1967
- e = H("div"), l && l.c(), P(e, "class", i = "wrap " + /*variant*/
1968
- n[8] + " " + /*show_progress*/
1969
- n[6] + " svelte-1yk38uw"), N(e, "hide", !/*status*/
1970
- n[4] || /*status*/
1971
- n[4] === "complete" || /*show_progress*/
1972
- n[6] === "hidden"), N(
1973
  e,
1974
  "translucent",
1975
  /*variant*/
1976
- n[8] === "center" && /*status*/
1977
- (n[4] === "pending" || /*status*/
1978
- n[4] === "error") || /*translucent*/
1979
- n[11] || /*show_progress*/
1980
- n[6] === "minimal"
1981
- ), N(
1982
  e,
1983
  "generating",
1984
  /*status*/
1985
- n[4] === "generating"
1986
- ), N(
1987
  e,
1988
  "border",
1989
  /*border*/
1990
- n[12]
1991
- ), Y(
1992
  e,
1993
  "position",
1994
  /*absolute*/
1995
- n[10] ? "absolute" : "static"
1996
- ), Y(
1997
  e,
1998
  "padding",
1999
  /*absolute*/
2000
- n[10] ? "0" : "var(--size-8) 0"
2001
  );
2002
  },
2003
  m(f, u) {
2004
- w(f, e, u), ~t && a[t].m(e, null), n[33](e), s = !0;
2005
  },
2006
  p(f, u) {
2007
- let _ = t;
2008
- t = r(f), t === _ ? ~t && a[t].p(f, u) : (l && (Ct(), Q(a[_], 1, 1, () => {
2009
- a[_] = null;
2010
- }), pt()), ~t ? (l = a[t], l ? l.p(f, u) : (l = a[t] = o[t](f), l.c()), K(l, 1), l.m(e, null)) : l = null), (!s || u[0] & /*variant, show_progress*/
2011
  320 && i !== (i = "wrap " + /*variant*/
2012
  f[8] + " " + /*show_progress*/
2013
  f[6] + " svelte-1yk38uw")) && P(e, "class", i), (!s || u[0] & /*variant, show_progress, status, show_progress*/
2014
- 336) && N(e, "hide", !/*status*/
2015
  f[4] || /*status*/
2016
  f[4] === "complete" || /*show_progress*/
2017
  f[6] === "hidden"), (!s || u[0] & /*variant, show_progress, variant, status, translucent, show_progress*/
2018
- 2384) && N(
2019
  e,
2020
  "translucent",
2021
  /*variant*/
@@ -2025,25 +2096,25 @@ function an(n) {
2025
  f[11] || /*show_progress*/
2026
  f[6] === "minimal"
2027
  ), (!s || u[0] & /*variant, show_progress, status*/
2028
- 336) && N(
2029
  e,
2030
  "generating",
2031
  /*status*/
2032
  f[4] === "generating"
2033
  ), (!s || u[0] & /*variant, show_progress, border*/
2034
- 4416) && N(
2035
  e,
2036
  "border",
2037
  /*border*/
2038
  f[12]
2039
  ), u[0] & /*absolute*/
2040
- 1024 && Y(
2041
  e,
2042
  "position",
2043
  /*absolute*/
2044
  f[10] ? "absolute" : "static"
2045
  ), u[0] & /*absolute*/
2046
- 1024 && Y(
2047
  e,
2048
  "padding",
2049
  /*absolute*/
@@ -2051,17 +2122,17 @@ function an(n) {
2051
  );
2052
  },
2053
  i(f) {
2054
- s || (K(l), s = !0);
2055
  },
2056
  o(f) {
2057
- Q(l), s = !1;
2058
  },
2059
  d(f) {
2060
- f && g(e), ~t && a[t].d(), n[33](null);
2061
  }
2062
  };
2063
  }
2064
- var un = function(n, e, t, l) {
2065
  function i(s) {
2066
  return s instanceof t ? s : new t(function(o) {
2067
  o(s);
@@ -2070,138 +2141,138 @@ var un = function(n, e, t, l) {
2070
  return new (t || (t = Promise))(function(s, o) {
2071
  function a(u) {
2072
  try {
2073
- f(l.next(u));
2074
- } catch (_) {
2075
- o(_);
2076
  }
2077
  }
2078
  function r(u) {
2079
  try {
2080
- f(l.throw(u));
2081
- } catch (_) {
2082
- o(_);
2083
  }
2084
  }
2085
  function f(u) {
2086
  u.done ? s(u.value) : i(u.value).then(a, r);
2087
  }
2088
- f((l = l.apply(n, e || [])).next());
2089
  });
2090
  };
2091
  let we = [], Le = !1;
2092
- function cn(n) {
2093
- return un(this, arguments, void 0, function* (e, t = !0) {
2094
  if (!(window.__gradio_mode__ === "website" || window.__gradio_mode__ !== "app" && t !== !0)) {
2095
  if (we.push(e), !Le)
2096
  Le = !0;
2097
  else
2098
  return;
2099
- yield Ul(), requestAnimationFrame(() => {
2100
- let l = [0, 0];
2101
  for (let i = 0; i < we.length; i++) {
2102
  const o = we[i].getBoundingClientRect();
2103
- (i === 0 || o.top + window.scrollY <= l[0]) && (l[0] = o.top + window.scrollY, l[1] = i);
2104
  }
2105
- window.scrollTo({ top: l[0] - 20, behavior: "smooth" }), Le = !1, we = [];
2106
  });
2107
  }
2108
  });
2109
  }
2110
- function _n(n, e, t) {
2111
- let l, { $$slots: i = {}, $$scope: s } = e;
2112
  this && this.__awaiter;
2113
- const o = Kl();
2114
- let { i18n: a } = e, { eta: r = null } = e, { queue_position: f } = e, { queue_size: u } = e, { status: _ } = e, { scroll_to_output: k = !1 } = e, { timer: m = !0 } = e, { show_progress: p = "full" } = e, { message: C = null } = e, { progress: y = null } = e, { variant: L = "default" } = e, { loading_text: d = "Loading..." } = e, { absolute: c = !0 } = e, { translucent: q = !1 } = e, { border: z = !1 } = e, { autoscroll: h } = e, M, T = !1, ue = 0, G = 0, x = null, $ = null, Ee = 0, O = null, fe, X = null, je = !0;
2115
  const Nt = () => {
2116
- t(0, r = t(27, x = t(19, ce = null))), t(25, ue = performance.now()), t(26, G = 0), T = !0, Ie();
2117
  };
2118
- function Ie() {
2119
  requestAnimationFrame(() => {
2120
- t(26, G = (performance.now() - ue) / 1e3), T && Ie();
2121
  });
2122
  }
2123
  function Ze() {
2124
- t(26, G = 0), t(0, r = t(27, x = t(19, ce = null))), T && (T = !1);
2125
  }
2126
- Jl(() => {
2127
- T && Ze();
2128
  });
2129
  let ce = null;
2130
- function At(b) {
2131
- Ge[b ? "unshift" : "push"](() => {
2132
- X = b, t(16, X), t(7, y), t(14, O), t(15, fe);
2133
  });
2134
  }
2135
- const Et = () => {
2136
  o("clear_status");
2137
  };
2138
- function jt(b) {
2139
- Ge[b ? "unshift" : "push"](() => {
2140
- M = b, t(13, M);
2141
  });
2142
  }
2143
- return n.$$set = (b) => {
2144
- "i18n" in b && t(1, a = b.i18n), "eta" in b && t(0, r = b.eta), "queue_position" in b && t(2, f = b.queue_position), "queue_size" in b && t(3, u = b.queue_size), "status" in b && t(4, _ = b.status), "scroll_to_output" in b && t(22, k = b.scroll_to_output), "timer" in b && t(5, m = b.timer), "show_progress" in b && t(6, p = b.show_progress), "message" in b && t(23, C = b.message), "progress" in b && t(7, y = b.progress), "variant" in b && t(8, L = b.variant), "loading_text" in b && t(9, d = b.loading_text), "absolute" in b && t(10, c = b.absolute), "translucent" in b && t(11, q = b.translucent), "border" in b && t(12, z = b.border), "autoscroll" in b && t(24, h = b.autoscroll), "$$scope" in b && t(29, s = b.$$scope);
2145
- }, n.$$.update = () => {
2146
- n.$$.dirty[0] & /*eta, old_eta, timer_start, eta_from_start*/
2147
- 436207617 && (r === null && t(0, r = x), r != null && x !== r && (t(28, $ = (performance.now() - ue) / 1e3 + r), t(19, ce = $.toFixed(1)), t(27, x = r))), n.$$.dirty[0] & /*eta_from_start, timer_diff*/
2148
- 335544320 && t(17, Ee = $ === null || $ <= 0 || !G ? null : Math.min(G / $, 1)), n.$$.dirty[0] & /*progress*/
2149
- 128 && y != null && t(18, je = !1), n.$$.dirty[0] & /*progress, progress_level, progress_bar, last_progress_level*/
2150
- 114816 && (y != null ? t(14, O = y.map((b) => {
2151
- if (b.index != null && b.length != null)
2152
- return b.index / b.length;
2153
- if (b.progress != null)
2154
- return b.progress;
2155
- })) : t(14, O = null), O ? (t(15, fe = O[O.length - 1]), X && (fe === 0 ? t(16, X.style.transition = "0", X) : t(16, X.style.transition = "150ms", X))) : t(15, fe = void 0)), n.$$.dirty[0] & /*status*/
2156
- 16 && (_ === "pending" ? Nt() : Ze()), n.$$.dirty[0] & /*el, scroll_to_output, status, autoscroll*/
2157
- 20979728 && M && k && (_ === "pending" || _ === "complete") && cn(M, h), n.$$.dirty[0] & /*status, message*/
2158
- 8388624, n.$$.dirty[0] & /*timer_diff*/
2159
- 67108864 && t(20, l = G.toFixed(1));
2160
  }, [
2161
  r,
2162
  a,
2163
  f,
2164
  u,
2165
- _,
2166
  m,
2167
- p,
2168
  y,
2169
- L,
 
2170
  d,
2171
- c,
2172
  q,
2173
  z,
2174
- M,
2175
- O,
2176
- fe,
2177
  X,
2178
- Ee,
2179
- je,
 
 
2180
  ce,
2181
- l,
2182
  o,
2183
- k,
2184
- C,
2185
- h,
2186
  ue,
2187
- G,
2188
  x,
2189
  $,
2190
  s,
2191
  i,
2192
- At,
2193
  Et,
2194
- jt
 
2195
  ];
2196
  }
2197
- class dn extends Hl {
2198
  constructor(e) {
2199
- super(), Yl(
2200
  this,
2201
  e,
2202
- _n,
2203
- an,
2204
- Gl,
2205
  {
2206
  i18n: 1,
2207
  eta: 0,
@@ -2226,61 +2297,61 @@ class dn extends Hl {
2226
  }
2227
  }
2228
  const {
2229
- SvelteComponent: mn,
2230
- append: bn,
2231
  attr: re,
2232
  detach: Lt,
2233
  element: ot,
2234
- empty: hn,
2235
- init: gn,
2236
  insert: St,
2237
  noop: rt,
2238
- safe_not_equal: wn,
2239
  src_url_equal: at,
2240
- toggle_class: le
2241
  } = window.__gradio__svelte__internal;
2242
- function ut(n) {
2243
- let e, t, l;
2244
  return {
2245
  c() {
2246
- e = ot("div"), t = ot("img"), at(t.src, l = /*value*/
2247
- n[0].url) || re(t, "src", l), re(t, "alt", ""), re(t, "class", "svelte-giydt1"), re(e, "class", "container svelte-giydt1"), le(
2248
  e,
2249
  "table",
2250
  /*type*/
2251
- n[1] === "table"
2252
- ), le(
2253
  e,
2254
  "gallery",
2255
  /*type*/
2256
- n[1] === "gallery"
2257
- ), le(
2258
  e,
2259
  "selected",
2260
  /*selected*/
2261
- n[2]
2262
  );
2263
  },
2264
  m(i, s) {
2265
- St(i, e, s), bn(e, t);
2266
  },
2267
  p(i, s) {
2268
  s & /*value*/
2269
- 1 && !at(t.src, l = /*value*/
2270
- i[0].url) && re(t, "src", l), s & /*type*/
2271
- 2 && le(
2272
  e,
2273
  "table",
2274
  /*type*/
2275
  i[1] === "table"
2276
  ), s & /*type*/
2277
- 2 && le(
2278
  e,
2279
  "gallery",
2280
  /*type*/
2281
  i[1] === "gallery"
2282
  ), s & /*selected*/
2283
- 4 && le(
2284
  e,
2285
  "selected",
2286
  /*selected*/
@@ -2292,173 +2363,173 @@ function ut(n) {
2292
  }
2293
  };
2294
  }
2295
- function kn(n) {
2296
  let e, t = (
2297
  /*value*/
2298
- n[0] && ut(n)
2299
  );
2300
  return {
2301
  c() {
2302
- t && t.c(), e = hn();
2303
  },
2304
- m(l, i) {
2305
- t && t.m(l, i), St(l, e, i);
2306
  },
2307
- p(l, [i]) {
2308
  /*value*/
2309
- l[0] ? t ? t.p(l, i) : (t = ut(l), t.c(), t.m(e.parentNode, e)) : t && (t.d(1), t = null);
2310
  },
2311
  i: rt,
2312
  o: rt,
2313
- d(l) {
2314
- l && Lt(e), t && t.d(l);
2315
  }
2316
  };
2317
  }
2318
- function pn(n, e, t) {
2319
- let { value: l } = e, { type: i } = e, { selected: s = !1 } = e;
2320
- return n.$$set = (o) => {
2321
- "value" in o && t(0, l = o.value), "type" in o && t(1, i = o.type), "selected" in o && t(2, s = o.selected);
2322
- }, [l, i, s];
2323
  }
2324
- class Wn extends mn {
2325
  constructor(e) {
2326
- super(), gn(this, e, pn, kn, wn, { value: 0, type: 1, selected: 2 });
2327
  }
2328
  }
2329
  const {
2330
- SvelteComponent: yn,
2331
- assign: vn,
2332
- attr: qn,
2333
- binding_callbacks: Cn,
2334
- check_outros: Fn,
2335
- create_component: Mt,
2336
- destroy_component: Vt,
2337
  detach: Ne,
2338
- element: Ln,
2339
- empty: Sn,
2340
- flush: Z,
2341
- get_spread_object: Mn,
2342
- get_spread_update: Vn,
2343
- group_outros: zn,
2344
- init: Nn,
2345
- insert: Ae,
2346
- mount_component: zt,
2347
- safe_not_equal: An,
2348
  set_style: ct,
2349
- space: En,
2350
  transition_in: ae,
2351
  transition_out: ye
2352
- } = window.__gradio__svelte__internal, { onMount: jn } = window.__gradio__svelte__internal;
2353
- function _t(n) {
2354
  let e, t;
2355
- return e = new nl({
2356
  props: {
2357
  visible: (
2358
  /*visible*/
2359
- n[3]
2360
  ),
2361
  variant: "solid",
2362
  border_mode: (
2363
  /*dragging*/
2364
- n[11] ? "focus" : "base"
2365
  ),
2366
  padding: !1,
2367
  elem_id: (
2368
  /*elem_id*/
2369
- n[1]
2370
  ),
2371
  elem_classes: (
2372
  /*elem_classes*/
2373
- n[2]
2374
  ),
2375
  allow_overflow: !1,
2376
  container: (
2377
  /*container*/
2378
- n[4]
2379
  ),
2380
  scale: (
2381
  /*scale*/
2382
- n[5]
2383
  ),
2384
  min_width: (
2385
  /*min_width*/
2386
- n[6]
2387
  ),
2388
- $$slots: { default: [In] },
2389
- $$scope: { ctx: n }
2390
  }
2391
  }), {
2392
  c() {
2393
- Mt(e.$$.fragment);
2394
  },
2395
- m(l, i) {
2396
- zt(e, l, i), t = !0;
2397
  },
2398
- p(l, i) {
2399
  const s = {};
2400
  i & /*visible*/
2401
  8 && (s.visible = /*visible*/
2402
- l[3]), i & /*elem_id*/
2403
  2 && (s.elem_id = /*elem_id*/
2404
- l[1]), i & /*elem_classes*/
2405
  4 && (s.elem_classes = /*elem_classes*/
2406
- l[2]), i & /*container*/
2407
  16 && (s.container = /*container*/
2408
- l[4]), i & /*scale*/
2409
  32 && (s.scale = /*scale*/
2410
- l[5]), i & /*min_width*/
2411
  64 && (s.min_width = /*min_width*/
2412
- l[6]), i & /*$$scope, ref, height, gradio, loading_status*/
2413
- 67201 && (s.$$scope = { dirty: i, ctx: l }), e.$set(s);
2414
  },
2415
- i(l) {
2416
- t || (ae(e.$$.fragment, l), t = !0);
2417
  },
2418
- o(l) {
2419
- ye(e.$$.fragment, l), t = !1;
2420
  },
2421
- d(l) {
2422
- Vt(e, l);
2423
  }
2424
  };
2425
  }
2426
- function In(n) {
2427
- let e, t, l, i;
2428
  const s = [
2429
  { autoscroll: (
2430
  /*gradio*/
2431
- n[9].autoscroll
2432
  ) },
2433
  { i18n: (
2434
  /*gradio*/
2435
- n[9].i18n
2436
  ) },
2437
- /*loading_status*/
2438
- n[7]
2439
  ];
2440
  let o = {};
2441
  for (let a = 0; a < s.length; a += 1)
2442
- o = vn(o, s[a]);
2443
- return e = new dn({ props: o }), e.$on(
2444
  "clear_status",
2445
  /*clear_status_handler*/
2446
- n[14]
2447
  ), {
2448
  c() {
2449
- Mt(e.$$.fragment), t = En(), l = Ln("div"), qn(l, "class", "viewer svelte-gu2pck"), ct(
2450
- l,
2451
  "height",
2452
  /*height*/
2453
- n[0]
2454
  );
2455
  },
2456
  m(a, r) {
2457
- zt(e, a, r), Ae(a, t, r), Ae(a, l, r), n[15](l), i = !0;
2458
  },
2459
  p(a, r) {
2460
- const f = r & /*gradio, loading_status*/
2461
- 640 ? Vn(s, [
2462
  r & /*gradio*/
2463
  512 && { autoscroll: (
2464
  /*gradio*/
@@ -2469,15 +2540,15 @@ function In(n) {
2469
  /*gradio*/
2470
  a[9].i18n
2471
  ) },
2472
- r & /*loading_status*/
2473
- 128 && Mn(
2474
- /*loading_status*/
2475
- a[7]
2476
  )
2477
  ]) : {};
2478
  e.$set(f), r & /*height*/
2479
  1 && ct(
2480
- l,
2481
  "height",
2482
  /*height*/
2483
  a[0]
@@ -2490,88 +2561,100 @@ function In(n) {
2490
  ye(e.$$.fragment, a), i = !1;
2491
  },
2492
  d(a) {
2493
- a && (Ne(t), Ne(l)), Vt(e, a), n[15](null);
2494
  }
2495
  };
2496
  }
2497
- function Zn(n) {
2498
- let e, t, l = !/*interactive*/
2499
- n[8] && _t(n);
2500
  return {
2501
  c() {
2502
- l && l.c(), e = Sn();
2503
  },
2504
  m(i, s) {
2505
- l && l.m(i, s), Ae(i, e, s), t = !0;
2506
  },
2507
  p(i, [s]) {
2508
  /*interactive*/
2509
- i[8] ? l && (zn(), ye(l, 1, 1, () => {
2510
- l = null;
2511
- }), Fn()) : l ? (l.p(i, s), s & /*interactive*/
2512
- 256 && ae(l, 1)) : (l = _t(i), l.c(), ae(l, 1), l.m(e.parentNode, e));
2513
  },
2514
  i(i) {
2515
- t || (ae(l), t = !0);
2516
  },
2517
  o(i) {
2518
- ye(l), t = !1;
2519
  },
2520
  d(i) {
2521
- i && Ne(e), l && l.d(i);
2522
  }
2523
  };
2524
  }
2525
- function Pn(n, e, t) {
2526
- let { elem_id: l = "" } = e, { elem_classes: i = [] } = e, { visible: s = !0 } = e, { height: o = 640 } = e, { value: a = null } = e, { container: r = !0 } = e, { scale: f = null } = e, { min_width: u = void 0 } = e, { loading_status: _ } = e, { interactive: k } = e, { gradio: m } = e, p, C, y;
2527
- jn(() => (t(13, C = new Ht()), C.start(void 0, y), () => C.stop()));
2528
- const L = () => m.dispatch("clear_status", _);
2529
- function d(c) {
2530
- Cn[c ? "unshift" : "push"](() => {
2531
- y = c, t(10, y);
 
 
 
 
 
 
 
 
 
 
 
 
2532
  });
2533
  }
2534
- return n.$$set = (c) => {
2535
- "elem_id" in c && t(1, l = c.elem_id), "elem_classes" in c && t(2, i = c.elem_classes), "visible" in c && t(3, s = c.visible), "height" in c && t(0, o = c.height), "value" in c && t(12, a = c.value), "container" in c && t(4, r = c.container), "scale" in c && t(5, f = c.scale), "min_width" in c && t(6, u = c.min_width), "loading_status" in c && t(7, _ = c.loading_status), "interactive" in c && t(8, k = c.interactive), "gradio" in c && t(9, m = c.gradio);
2536
- }, n.$$.update = () => {
2537
- if (n.$$.dirty & /*height*/
2538
- 1 && t(0, o = typeof o == "number" ? `${o}px` : o), n.$$.dirty & /*value, gradio*/
2539
- 4608 && m.dispatch("change"), n.$$.dirty & /*value, rr*/
2540
- 12288 && a !== null && Array.isArray(a))
2541
- for (const c of a)
2542
- typeof c != "string" ? c.url && C.open(c.url) : C.open(c);
2543
  }, [
2544
  o,
2545
- l,
2546
  i,
2547
  s,
2548
  r,
2549
  f,
2550
  u,
2551
- _,
2552
- k,
2553
- m,
2554
- y,
2555
  p,
2556
- a,
2557
- C,
2558
  L,
2559
- d
 
 
 
 
 
 
2560
  ];
2561
  }
2562
- class Bn extends yn {
2563
  constructor(e) {
2564
- super(), Nn(this, e, Pn, Zn, An, {
2565
  elem_id: 1,
2566
  elem_classes: 2,
2567
  visible: 3,
2568
  height: 0,
2569
- value: 12,
2570
  container: 4,
2571
  scale: 5,
2572
  min_width: 6,
2573
  loading_status: 7,
2574
  interactive: 8,
 
2575
  gradio: 9
2576
  });
2577
  }
@@ -2579,70 +2662,76 @@ class Bn extends yn {
2579
  return this.$$.ctx[1];
2580
  }
2581
  set elem_id(e) {
2582
- this.$$set({ elem_id: e }), Z();
2583
  }
2584
  get elem_classes() {
2585
  return this.$$.ctx[2];
2586
  }
2587
  set elem_classes(e) {
2588
- this.$$set({ elem_classes: e }), Z();
2589
  }
2590
  get visible() {
2591
  return this.$$.ctx[3];
2592
  }
2593
  set visible(e) {
2594
- this.$$set({ visible: e }), Z();
2595
  }
2596
  get height() {
2597
  return this.$$.ctx[0];
2598
  }
2599
  set height(e) {
2600
- this.$$set({ height: e }), Z();
2601
  }
2602
  get value() {
2603
- return this.$$.ctx[12];
2604
  }
2605
  set value(e) {
2606
- this.$$set({ value: e }), Z();
2607
  }
2608
  get container() {
2609
  return this.$$.ctx[4];
2610
  }
2611
  set container(e) {
2612
- this.$$set({ container: e }), Z();
2613
  }
2614
  get scale() {
2615
  return this.$$.ctx[5];
2616
  }
2617
  set scale(e) {
2618
- this.$$set({ scale: e }), Z();
2619
  }
2620
  get min_width() {
2621
  return this.$$.ctx[6];
2622
  }
2623
  set min_width(e) {
2624
- this.$$set({ min_width: e }), Z();
2625
  }
2626
  get loading_status() {
2627
  return this.$$.ctx[7];
2628
  }
2629
  set loading_status(e) {
2630
- this.$$set({ loading_status: e }), Z();
2631
  }
2632
  get interactive() {
2633
  return this.$$.ctx[8];
2634
  }
2635
  set interactive(e) {
2636
- this.$$set({ interactive: e }), Z();
 
 
 
 
 
 
2637
  }
2638
  get gradio() {
2639
  return this.$$.ctx[9];
2640
  }
2641
  set gradio(e) {
2642
- this.$$set({ gradio: e }), Z();
2643
  }
2644
  }
2645
  export {
2646
- Wn as BaseExample,
2647
- Bn as default
2648
  };
 
1
+ let he = null;
2
  async function Bt() {
3
+ return he || (he = (await import("./re_viewer-DOCTrs8v.js")).WebHandle, he);
4
  }
5
  function Dt() {
6
+ const l = new Uint8Array(16);
7
+ return crypto.getRandomValues(l), Array.from(l).map((e) => e.toString(16).padStart(2, "0")).join("");
8
  }
9
  class Ht {
10
  /** @type {(import("./re_viewer.js").WebHandle) | null} */
11
  #e = null;
12
  /** @type {HTMLCanvasElement | null} */
13
+ #n = null;
14
  /** @type {'ready' | 'starting' | 'stopped'} */
15
  #t = "stopped";
16
  /**
 
18
  *
19
  * @param {string | string[]} [rrd] URLs to `.rrd` files or WebSocket connections to our SDK.
20
  * @param {HTMLElement} [parent] The element to attach the canvas onto.
21
+ * @param {boolean} [hide_welcome_screen] Whether to hide the welcome screen.
22
  * @returns {Promise<void>}
23
  */
24
+ async start(e, t = document.body, n = !1) {
25
  if (this.#t !== "stopped")
26
  return;
27
+ this.#t = "starting", this.#n = document.createElement("canvas"), this.#n.id = Dt(), t.append(this.#n);
28
+ let i = await Bt();
29
+ if (this.#t === "starting" && (this.#e = new i(), await this.#e.start(
30
+ this.#n.id,
31
+ void 0,
32
+ void 0,
33
+ void 0,
34
+ n
35
+ ), this.#t === "starting")) {
36
  if (this.#e.has_panicked())
37
  throw new Error(`Web viewer crashed: ${this.#e.panic_message()}`);
38
+ this.#t = "ready", e && this.open(e);
39
  }
40
  }
41
  /**
 
52
  * @see {WebViewer.start}
53
  *
54
  * @param {string | string[]} rrd URLs to `.rrd` files or WebSocket connections to our SDK.
55
+ * @param {{ follow_if_http?: boolean }} options
56
+ * - follow_if_http: Whether Rerun should open the resource in "Following" mode when streaming
57
+ * from an HTTP url. Defaults to `false`. Ignored for non-HTTP URLs.
58
  */
59
+ open(e, t = {}) {
60
  if (!this.#e)
61
  throw new Error(`attempted to open \`${e}\` in a stopped viewer`);
62
+ const n = Array.isArray(e) ? e : [e];
63
+ for (const i of n)
64
+ if (this.#e.add_receiver(i, t.follow_if_http), this.#e.has_panicked())
65
  throw new Error(`Web viewer crashed: ${this.#e.panic_message()}`);
66
  }
67
  /**
 
77
  if (!this.#e)
78
  throw new Error(`attempted to close \`${e}\` in a stopped viewer`);
79
  const t = Array.isArray(e) ? e : [e];
80
+ for (const n of t)
81
+ if (this.#e.remove_receiver(n), this.#e.has_panicked())
82
  throw new Error(`Web viewer crashed: ${this.#e.panic_message()}`);
83
  }
84
  /**
 
87
  * The same viewer instance may be started multiple times.
88
  */
89
  stop() {
90
+ this.#t !== "stopped" && (this.#t = "stopped", this.#n?.remove(), this.#e?.destroy(), this.#e?.free(), this.#n = null, this.#e = null);
91
+ }
92
+ /**
93
+ * Opens a new channel for sending log messages.
94
+ *
95
+ * The channel can be used to incrementally push `rrd` chunks into the viewer.
96
+ *
97
+ * @param {string} channel_name used to identify the channel.
98
+ *
99
+ * @returns {LogChannel}
100
+ */
101
+ open_channel(e = "rerun-io/web-viewer") {
102
+ if (!this.#e)
103
+ throw new Error("...");
104
+ const t = crypto.randomUUID();
105
+ this.#e.open_channel(t, e);
106
+ const n = (o) => {
107
+ if (!this.#e)
108
+ throw new Error("...");
109
+ this.#e.send_rrd_to_channel(t, o);
110
+ }, i = () => {
111
+ if (!this.#e)
112
+ throw new Error("...");
113
+ this.#e.close_channel(t);
114
+ }, s = () => this.#t;
115
+ return new Ot(n, i, s);
116
+ }
117
+ }
118
+ class Ot {
119
+ #e;
120
+ #n;
121
+ #t;
122
+ #l = !1;
123
+ /** @internal
124
+ *
125
+ * @param {(data: Uint8Array) => void} on_send
126
+ * @param {() => void} on_close
127
+ * @param {() => 'ready' | 'starting' | 'stopped'} get_state
128
+ */
129
+ constructor(e, t, n) {
130
+ this.#e = e, this.#n = t, this.#t = n;
131
+ }
132
+ get ready() {
133
+ return !this.#l && this.#t() === "ready";
134
+ }
135
+ /**
136
+ * Send an `rrd` containing log messages to the viewer.
137
+ *
138
+ * Does nothing if `!this.ready`.
139
+ *
140
+ * @param {Uint8Array} rrd_bytes Is an rrd file stored in a byte array, received via some other side channel.
141
+ */
142
+ send_rrd(e) {
143
+ this.ready && this.#e(e);
144
+ }
145
+ /**
146
+ * Close the channel.
147
+ *
148
+ * Does nothing if `!this.ready`.
149
+ */
150
+ close() {
151
+ this.ready && (this.#n(), this.#l = !0);
152
  }
153
  }
154
  const {
155
  SvelteComponent: Tt,
156
+ assign: Ut,
157
+ create_slot: Jt,
158
+ detach: Rt,
159
+ element: Xt,
160
+ get_all_dirty_from_scope: Yt,
161
+ get_slot_changes: Gt,
162
+ get_spread_update: Kt,
163
+ init: Qt,
164
+ insert: xt,
165
+ safe_not_equal: $t,
166
  set_dynamic_element_data: Pe,
167
  set_style: V,
168
  toggle_class: B,
169
  transition_in: dt,
170
  transition_out: mt,
171
+ update_slot_base: en
172
  } = window.__gradio__svelte__internal;
173
+ function tn(l) {
174
+ let e, t, n;
175
  const i = (
176
  /*#slots*/
177
+ l[18].default
178
+ ), s = Jt(
179
  i,
180
+ l,
181
  /*$$scope*/
182
+ l[17],
183
  null
184
  );
185
  let o = [
186
  { "data-testid": (
187
  /*test_id*/
188
+ l[7]
189
  ) },
190
  { id: (
191
  /*elem_id*/
192
+ l[2]
193
  ) },
194
  {
195
  class: t = "block " + /*elem_classes*/
196
+ l[3].join(" ") + " svelte-nl1om8"
197
  }
198
  ], a = {};
199
  for (let r = 0; r < o.length; r += 1)
200
+ a = Ut(a, o[r]);
201
  return {
202
  c() {
203
+ e = Xt(
204
  /*tag*/
205
+ l[14]
206
  ), s && s.c(), Pe(
207
  /*tag*/
208
+ l[14]
209
  )(e, a), B(
210
  e,
211
  "hidden",
212
  /*visible*/
213
+ l[10] === !1
214
  ), B(
215
  e,
216
  "padded",
217
  /*padding*/
218
+ l[6]
219
  ), B(
220
  e,
221
  "border_focus",
222
  /*border_mode*/
223
+ l[5] === "focus"
224
  ), B(
225
  e,
226
  "border_contrast",
227
  /*border_mode*/
228
+ l[5] === "contrast"
229
  ), B(e, "hide-container", !/*explicit_call*/
230
+ l[8] && !/*container*/
231
+ l[9]), V(
232
  e,
233
  "height",
234
  /*get_dimension*/
235
+ l[15](
236
  /*height*/
237
+ l[0]
238
  )
239
  ), V(e, "width", typeof /*width*/
240
+ l[1] == "number" ? `calc(min(${/*width*/
241
+ l[1]}px, 100%))` : (
242
  /*get_dimension*/
243
+ l[15](
244
  /*width*/
245
+ l[1]
246
  )
247
  )), V(
248
  e,
249
  "border-style",
250
  /*variant*/
251
+ l[4]
252
  ), V(
253
  e,
254
  "overflow",
255
  /*allow_overflow*/
256
+ l[11] ? "visible" : "hidden"
257
  ), V(
258
  e,
259
  "flex-grow",
260
  /*scale*/
261
+ l[12]
262
  ), V(e, "min-width", `calc(min(${/*min_width*/
263
+ l[13]}px, 100%))`), V(e, "border-width", "var(--block-border-width)");
264
  },
265
  m(r, f) {
266
+ xt(r, e, f), s && s.m(e, null), n = !0;
267
  },
268
  p(r, f) {
269
+ s && s.p && (!n || f & /*$$scope*/
270
+ 131072) && en(
271
  s,
272
  i,
273
  r,
274
  /*$$scope*/
275
  r[17],
276
+ n ? Gt(
277
  i,
278
  /*$$scope*/
279
  r[17],
280
  f,
281
  null
282
+ ) : Yt(
283
  /*$$scope*/
284
  r[17]
285
  ),
 
287
  ), Pe(
288
  /*tag*/
289
  r[14]
290
+ )(e, a = Kt(o, [
291
+ (!n || f & /*test_id*/
292
  128) && { "data-testid": (
293
  /*test_id*/
294
  r[7]
295
  ) },
296
+ (!n || f & /*elem_id*/
297
  4) && { id: (
298
  /*elem_id*/
299
  r[2]
300
  ) },
301
+ (!n || f & /*elem_classes*/
302
  8 && t !== (t = "block " + /*elem_classes*/
303
  r[3].join(" ") + " svelte-nl1om8")) && { class: t }
304
  ])), B(
 
364
  r[13]}px, 100%))`);
365
  },
366
  i(r) {
367
+ n || (dt(s, r), n = !0);
368
  },
369
  o(r) {
370
+ mt(s, r), n = !1;
371
  },
372
  d(r) {
373
+ r && Rt(e), s && s.d(r);
374
  }
375
  };
376
  }
377
+ function nn(l) {
378
  let e, t = (
379
  /*tag*/
380
+ l[14] && tn(l)
381
  );
382
  return {
383
  c() {
384
  t && t.c();
385
  },
386
+ m(n, i) {
387
+ t && t.m(n, i), e = !0;
388
  },
389
+ p(n, [i]) {
390
  /*tag*/
391
+ n[14] && t.p(n, i);
392
  },
393
+ i(n) {
394
+ e || (dt(t, n), e = !0);
395
  },
396
+ o(n) {
397
+ mt(t, n), e = !1;
398
  },
399
+ d(n) {
400
+ t && t.d(n);
401
  }
402
  };
403
  }
404
+ function ln(l, e, t) {
405
+ let { $$slots: n = {}, $$scope: i } = e, { height: s = void 0 } = e, { width: o = void 0 } = e, { elem_id: a = "" } = e, { elem_classes: r = [] } = e, { variant: f = "solid" } = e, { border_mode: u = "base" } = e, { padding: c = !0 } = e, { type: p = "normal" } = e, { test_id: m = void 0 } = e, { explicit_call: y = !1 } = e, { container: L = !0 } = e, { visible: v = !0 } = e, { allow_overflow: F = !0 } = e, { scale: d = null } = e, { min_width: _ = 0 } = e, q = p === "fieldset" ? "fieldset" : "div";
406
+ const z = (b) => {
407
+ if (b !== void 0) {
408
+ if (typeof b == "number")
409
+ return b + "px";
410
+ if (typeof b == "string")
411
+ return b;
412
  }
413
  };
414
+ return l.$$set = (b) => {
415
+ "height" in b && t(0, s = b.height), "width" in b && t(1, o = b.width), "elem_id" in b && t(2, a = b.elem_id), "elem_classes" in b && t(3, r = b.elem_classes), "variant" in b && t(4, f = b.variant), "border_mode" in b && t(5, u = b.border_mode), "padding" in b && t(6, c = b.padding), "type" in b && t(16, p = b.type), "test_id" in b && t(7, m = b.test_id), "explicit_call" in b && t(8, y = b.explicit_call), "container" in b && t(9, L = b.container), "visible" in b && t(10, v = b.visible), "allow_overflow" in b && t(11, F = b.allow_overflow), "scale" in b && t(12, d = b.scale), "min_width" in b && t(13, _ = b.min_width), "$$scope" in b && t(17, i = b.$$scope);
416
  }, [
417
  s,
418
  o,
 
420
  r,
421
  f,
422
  u,
423
+ c,
424
  m,
 
 
425
  y,
426
  L,
427
+ v,
428
+ F,
429
  d,
430
+ _,
431
  q,
432
  z,
433
+ p,
434
  i,
435
+ n
436
  ];
437
  }
438
+ class sn extends Tt {
439
  constructor(e) {
440
+ super(), Qt(this, e, ln, nn, $t, {
441
  height: 0,
442
  width: 1,
443
  elem_id: 2,
 
457
  }
458
  }
459
  const {
460
+ SvelteComponent: fn,
461
  append: Se,
462
+ attr: T,
463
+ bubble: on,
464
+ create_component: rn,
465
+ destroy_component: an,
466
+ detach: ht,
467
+ element: ze,
468
+ init: un,
469
+ insert: bt,
470
+ listen: cn,
471
+ mount_component: _n,
472
+ safe_not_equal: dn,
473
+ set_data: mn,
474
  set_style: ee,
475
+ space: hn,
476
+ text: bn,
477
+ toggle_class: M,
478
+ transition_in: gn,
479
+ transition_out: wn
480
  } = window.__gradio__svelte__internal;
481
+ function We(l) {
482
  let e, t;
483
  return {
484
  c() {
485
+ e = ze("span"), t = bn(
486
  /*label*/
487
+ l[1]
488
+ ), T(e, "class", "svelte-1lrphxw");
489
  },
490
+ m(n, i) {
491
+ bt(n, e, i), Se(e, t);
492
  },
493
+ p(n, i) {
494
  i & /*label*/
495
+ 2 && mn(
496
  t,
497
  /*label*/
498
+ n[1]
499
  );
500
  },
501
+ d(n) {
502
+ n && ht(e);
503
  }
504
  };
505
  }
506
+ function kn(l) {
507
+ let e, t, n, i, s, o, a, r = (
508
  /*show_label*/
509
+ l[2] && We(l)
510
  );
511
  return i = new /*Icon*/
512
+ l[0]({}), {
513
  c() {
514
+ e = ze("button"), r && r.c(), t = hn(), n = ze("div"), rn(i.$$.fragment), T(n, "class", "svelte-1lrphxw"), M(
515
+ n,
516
  "small",
517
  /*size*/
518
+ l[4] === "small"
519
+ ), M(
520
+ n,
521
  "large",
522
  /*size*/
523
+ l[4] === "large"
524
+ ), M(
525
+ n,
526
  "medium",
527
  /*size*/
528
+ l[4] === "medium"
529
  ), e.disabled = /*disabled*/
530
+ l[7], T(
531
  e,
532
  "aria-label",
533
  /*label*/
534
+ l[1]
535
+ ), T(
536
  e,
537
  "aria-haspopup",
538
  /*hasPopup*/
539
+ l[8]
540
+ ), T(
541
  e,
542
  "title",
543
  /*label*/
544
+ l[1]
545
+ ), T(e, "class", "svelte-1lrphxw"), M(
546
  e,
547
  "pending",
548
  /*pending*/
549
+ l[3]
550
+ ), M(
551
  e,
552
  "padded",
553
  /*padded*/
554
+ l[5]
555
+ ), M(
556
  e,
557
  "highlight",
558
  /*highlight*/
559
+ l[6]
560
+ ), M(
561
  e,
562
  "transparent",
563
  /*transparent*/
564
+ l[9]
565
  ), ee(e, "color", !/*disabled*/
566
+ l[7] && /*_color*/
567
+ l[12] ? (
568
  /*_color*/
569
+ l[12]
570
  ) : "var(--block-label-text-color)"), ee(e, "--bg-color", /*disabled*/
571
+ l[7] ? "auto" : (
572
  /*background*/
573
+ l[10]
574
  )), ee(
575
  e,
576
  "margin-left",
577
  /*offset*/
578
+ l[11] + "px"
579
  );
580
  },
581
  m(f, u) {
582
+ bt(f, e, u), r && r.m(e, null), Se(e, t), Se(e, n), _n(i, n, null), s = !0, o || (a = cn(
583
  e,
584
  "click",
585
  /*click_handler*/
586
+ l[14]
587
  ), o = !0);
588
  },
589
  p(f, [u]) {
590
  /*show_label*/
591
  f[2] ? r ? r.p(f, u) : (r = We(f), r.c(), r.m(e, t)) : r && (r.d(1), r = null), (!s || u & /*size*/
592
+ 16) && M(
593
+ n,
594
  "small",
595
  /*size*/
596
  f[4] === "small"
597
  ), (!s || u & /*size*/
598
+ 16) && M(
599
+ n,
600
  "large",
601
  /*size*/
602
  f[4] === "large"
603
  ), (!s || u & /*size*/
604
+ 16) && M(
605
+ n,
606
  "medium",
607
  /*size*/
608
  f[4] === "medium"
609
  ), (!s || u & /*disabled*/
610
  128) && (e.disabled = /*disabled*/
611
  f[7]), (!s || u & /*label*/
612
+ 2) && T(
613
  e,
614
  "aria-label",
615
  /*label*/
616
  f[1]
617
  ), (!s || u & /*hasPopup*/
618
+ 256) && T(
619
  e,
620
  "aria-haspopup",
621
  /*hasPopup*/
622
  f[8]
623
  ), (!s || u & /*label*/
624
+ 2) && T(
625
  e,
626
  "title",
627
  /*label*/
628
  f[1]
629
  ), (!s || u & /*pending*/
630
+ 8) && M(
631
  e,
632
  "pending",
633
  /*pending*/
634
  f[3]
635
  ), (!s || u & /*padded*/
636
+ 32) && M(
637
  e,
638
  "padded",
639
  /*padded*/
640
  f[5]
641
  ), (!s || u & /*highlight*/
642
+ 64) && M(
643
  e,
644
  "highlight",
645
  /*highlight*/
646
  f[6]
647
  ), (!s || u & /*transparent*/
648
+ 512) && M(
649
  e,
650
  "transparent",
651
  /*transparent*/
 
670
  );
671
  },
672
  i(f) {
673
+ s || (gn(i.$$.fragment, f), s = !0);
674
  },
675
  o(f) {
676
+ wn(i.$$.fragment, f), s = !1;
677
  },
678
  d(f) {
679
+ f && ht(e), r && r.d(), an(i), o = !1, a();
680
  }
681
  };
682
  }
683
+ function pn(l, e, t) {
684
+ let n, { Icon: i } = e, { label: s = "" } = e, { show_label: o = !1 } = e, { pending: a = !1 } = e, { size: r = "small" } = e, { padded: f = !0 } = e, { highlight: u = !1 } = e, { disabled: c = !1 } = e, { hasPopup: p = !1 } = e, { color: m = "var(--block-label-text-color)" } = e, { transparent: y = !1 } = e, { background: L = "var(--background-fill-primary)" } = e, { offset: v = 0 } = e;
685
+ function F(d) {
686
+ on.call(this, l, d);
687
  }
688
+ return l.$$set = (d) => {
689
+ "Icon" in d && t(0, i = d.Icon), "label" in d && t(1, s = d.label), "show_label" in d && t(2, o = d.show_label), "pending" in d && t(3, a = d.pending), "size" in d && t(4, r = d.size), "padded" in d && t(5, f = d.padded), "highlight" in d && t(6, u = d.highlight), "disabled" in d && t(7, c = d.disabled), "hasPopup" in d && t(8, p = d.hasPopup), "color" in d && t(13, m = d.color), "transparent" in d && t(9, y = d.transparent), "background" in d && t(10, L = d.background), "offset" in d && t(11, v = d.offset);
690
+ }, l.$$.update = () => {
691
+ l.$$.dirty & /*highlight, color*/
692
+ 8256 && t(12, n = u ? "var(--color-accent)" : m);
693
  }, [
694
  i,
695
  s,
 
698
  r,
699
  f,
700
  u,
701
+ c,
 
702
  p,
 
703
  y,
704
+ L,
705
+ v,
706
+ n,
707
  m,
708
+ F
709
  ];
710
  }
711
+ class yn extends fn {
712
  constructor(e) {
713
+ super(), un(this, e, pn, kn, dn, {
714
  Icon: 0,
715
  label: 1,
716
  show_label: 2,
 
728
  }
729
  }
730
  const {
731
+ SvelteComponent: vn,
732
  append: Ce,
733
+ attr: I,
734
+ detach: qn,
735
+ init: Cn,
736
+ insert: Fn,
737
  noop: Fe,
738
+ safe_not_equal: Ln,
739
  set_style: D,
740
+ svg_element: be
741
  } = window.__gradio__svelte__internal;
742
+ function Sn(l) {
743
+ let e, t, n, i;
744
  return {
745
  c() {
746
+ e = be("svg"), t = be("g"), n = be("path"), i = be("path"), I(n, "d", "M18,6L6.087,17.913"), D(n, "fill", "none"), D(n, "fill-rule", "nonzero"), D(n, "stroke-width", "2px"), I(t, "transform", "matrix(1.14096,-0.140958,-0.140958,1.14096,-0.0559523,0.0559523)"), I(i, "d", "M4.364,4.364L19.636,19.636"), D(i, "fill", "none"), D(i, "fill-rule", "nonzero"), D(i, "stroke-width", "2px"), I(e, "width", "100%"), I(e, "height", "100%"), I(e, "viewBox", "0 0 24 24"), I(e, "version", "1.1"), I(e, "xmlns", "http://www.w3.org/2000/svg"), I(e, "xmlns:xlink", "http://www.w3.org/1999/xlink"), I(e, "xml:space", "preserve"), I(e, "stroke", "currentColor"), D(e, "fill-rule", "evenodd"), D(e, "clip-rule", "evenodd"), D(e, "stroke-linecap", "round"), D(e, "stroke-linejoin", "round");
747
  },
748
  m(s, o) {
749
+ Fn(s, e, o), Ce(e, t), Ce(t, n), Ce(e, i);
750
  },
751
  p: Fe,
752
  i: Fe,
753
  o: Fe,
754
  d(s) {
755
+ s && qn(e);
756
  }
757
  };
758
  }
759
+ class zn extends vn {
760
  constructor(e) {
761
+ super(), Cn(this, e, null, Sn, Ln, {});
762
  }
763
  }
764
+ const Mn = [
765
  { color: "red", primary: 600, secondary: 100 },
766
  { color: "green", primary: 600, secondary: 100 },
767
  { color: "blue", primary: 600, secondary: 100 },
 
1065
  950: "#4c0519"
1066
  }
1067
  };
1068
+ Mn.reduce(
1069
+ (l, { color: e, primary: t, secondary: n }) => ({
1070
+ ...l,
1071
  [e]: {
1072
  primary: Be[e][t],
1073
+ secondary: Be[e][n]
1074
  }
1075
  }),
1076
  {}
1077
  );
1078
+ function le(l) {
1079
  let e = ["", "k", "M", "G", "T", "P", "E", "Z"], t = 0;
1080
+ for (; l > 1e3 && t < e.length - 1; )
1081
+ l /= 1e3, t++;
1082
+ let n = e[t];
1083
+ return (Number.isInteger(l) ? l : l.toFixed(1)) + n;
1084
  }
1085
  function ke() {
1086
  }
1087
+ function Vn(l, e) {
1088
+ return l != l ? e == e : l !== e || l && typeof l == "object" || typeof l == "function";
1089
  }
1090
  const gt = typeof window < "u";
1091
+ let De = gt ? () => window.performance.now() : () => Date.now(), wt = gt ? (l) => requestAnimationFrame(l) : ke;
1092
  const ie = /* @__PURE__ */ new Set();
1093
+ function kt(l) {
1094
  ie.forEach((e) => {
1095
+ e.c(l) || (ie.delete(e), e.f());
1096
  }), ie.size !== 0 && wt(kt);
1097
  }
1098
+ function Nn(l) {
1099
  let e;
1100
  return ie.size === 0 && wt(kt), {
1101
  promise: new Promise((t) => {
1102
+ ie.add(e = { c: l, f: t });
1103
  }),
1104
  abort() {
1105
  ie.delete(e);
 
1107
  };
1108
  }
1109
  const te = [];
1110
+ function En(l, e = ke) {
1111
  let t;
1112
+ const n = /* @__PURE__ */ new Set();
1113
  function i(a) {
1114
+ if (Vn(l, a) && (l = a, t)) {
1115
  const r = !te.length;
1116
+ for (const f of n)
1117
+ f[1](), te.push(f, l);
1118
  if (r) {
1119
  for (let f = 0; f < te.length; f += 2)
1120
  te[f][0](te[f + 1]);
 
1123
  }
1124
  }
1125
  function s(a) {
1126
+ i(a(l));
1127
  }
1128
  function o(a, r = ke) {
1129
  const f = [a, r];
1130
+ return n.add(f), n.size === 1 && (t = e(i, s) || ke), a(l), () => {
1131
+ n.delete(f), n.size === 0 && t && (t(), t = null);
1132
  };
1133
  }
1134
  return { set: i, update: s, subscribe: o };
1135
  }
1136
+ function He(l) {
1137
+ return Object.prototype.toString.call(l) === "[object Date]";
1138
  }
1139
+ function Me(l, e, t, n) {
1140
  if (typeof t == "number" || He(t)) {
1141
+ const i = n - t, s = (t - e) / (l.dt || 1 / 60), o = l.opts.stiffness * i, a = l.opts.damping * s, r = (o - a) * l.inv_mass, f = (s + r) * l.dt;
1142
+ return Math.abs(f) < l.opts.precision && Math.abs(i) < l.opts.precision ? n : (l.settled = !1, He(t) ? new Date(t.getTime() + f) : t + f);
1143
  } else {
1144
  if (Array.isArray(t))
1145
  return t.map(
1146
+ (i, s) => Me(l, e[s], t[s], n[s])
1147
  );
1148
  if (typeof t == "object") {
1149
  const i = {};
1150
  for (const s in t)
1151
+ i[s] = Me(l, e[s], t[s], n[s]);
1152
  return i;
1153
  } else
1154
  throw new Error(`Cannot spring ${typeof t} values`);
1155
  }
1156
  }
1157
+ function Oe(l, e = {}) {
1158
+ const t = En(l), { stiffness: n = 0.15, damping: i = 0.8, precision: s = 0.01 } = e;
1159
+ let o, a, r, f = l, u = l, c = 1, p = 0, m = !1;
1160
+ function y(v, F = {}) {
1161
+ u = v;
1162
  const d = r = {};
1163
+ return l == null || F.hard || L.stiffness >= 1 && L.damping >= 1 ? (m = !0, o = De(), f = v, t.set(l = u), Promise.resolve()) : (F.soft && (p = 1 / ((F.soft === !0 ? 0.5 : +F.soft) * 60), c = 0), a || (o = De(), m = !1, a = Nn((_) => {
1164
  if (m)
1165
  return m = !1, a = null, !1;
1166
+ c = Math.min(c + p, 1);
1167
  const q = {
1168
+ inv_mass: c,
1169
+ opts: L,
1170
  settled: !0,
1171
+ dt: (_ - o) * 60 / 1e3
1172
+ }, z = Me(q, f, l, u);
1173
+ return o = _, f = l, t.set(l = z), q.settled && (a = null), !q.settled;
1174
+ })), new Promise((_) => {
1175
  a.promise.then(() => {
1176
+ d === r && _();
1177
  });
1178
  }));
1179
  }
1180
+ const L = {
1181
+ set: y,
1182
+ update: (v, F) => y(v(u, l), F),
1183
  subscribe: t.subscribe,
1184
+ stiffness: n,
1185
  damping: i,
1186
  precision: s
1187
  };
1188
+ return L;
1189
  }
1190
  const {
1191
+ SvelteComponent: An,
1192
  append: j,
1193
+ attr: C,
1194
+ component_subscribe: Te,
1195
+ detach: In,
1196
+ element: jn,
1197
+ init: Zn,
1198
+ insert: Pn,
1199
+ noop: Ue,
1200
+ safe_not_equal: Wn,
1201
  set_style: ge,
1202
+ svg_element: Z,
1203
+ toggle_class: Je
1204
+ } = window.__gradio__svelte__internal, { onMount: Bn } = window.__gradio__svelte__internal;
1205
+ function Dn(l) {
1206
+ let e, t, n, i, s, o, a, r, f, u, c, p;
1207
  return {
1208
  c() {
1209
+ e = jn("div"), t = Z("svg"), n = Z("g"), i = Z("path"), s = Z("path"), o = Z("path"), a = Z("path"), r = Z("g"), f = Z("path"), u = Z("path"), c = Z("path"), p = Z("path"), C(i, "d", "M255.926 0.754768L509.702 139.936V221.027L255.926 81.8465V0.754768Z"), C(i, "fill", "#FF7C00"), C(i, "fill-opacity", "0.4"), C(i, "class", "svelte-43sxxs"), C(s, "d", "M509.69 139.936L254.981 279.641V361.255L509.69 221.55V139.936Z"), C(s, "fill", "#FF7C00"), C(s, "class", "svelte-43sxxs"), C(o, "d", "M0.250138 139.937L254.981 279.641V361.255L0.250138 221.55V139.937Z"), C(o, "fill", "#FF7C00"), C(o, "fill-opacity", "0.4"), C(o, "class", "svelte-43sxxs"), C(a, "d", "M255.923 0.232622L0.236328 139.936V221.55L255.923 81.8469V0.232622Z"), C(a, "fill", "#FF7C00"), C(a, "class", "svelte-43sxxs"), ge(n, "transform", "translate(" + /*$top*/
1210
+ l[1][0] + "px, " + /*$top*/
1211
+ l[1][1] + "px)"), C(f, "d", "M255.926 141.5L509.702 280.681V361.773L255.926 222.592V141.5Z"), C(f, "fill", "#FF7C00"), C(f, "fill-opacity", "0.4"), C(f, "class", "svelte-43sxxs"), C(u, "d", "M509.69 280.679L254.981 420.384V501.998L509.69 362.293V280.679Z"), C(u, "fill", "#FF7C00"), C(u, "class", "svelte-43sxxs"), C(c, "d", "M0.250138 280.681L254.981 420.386V502L0.250138 362.295V280.681Z"), C(c, "fill", "#FF7C00"), C(c, "fill-opacity", "0.4"), C(c, "class", "svelte-43sxxs"), C(p, "d", "M255.923 140.977L0.236328 280.68V362.294L255.923 222.591V140.977Z"), C(p, "fill", "#FF7C00"), C(p, "class", "svelte-43sxxs"), ge(r, "transform", "translate(" + /*$bottom*/
1212
+ l[2][0] + "px, " + /*$bottom*/
1213
+ l[2][1] + "px)"), C(t, "viewBox", "-1200 -1200 3000 3000"), C(t, "fill", "none"), C(t, "xmlns", "http://www.w3.org/2000/svg"), C(t, "class", "svelte-43sxxs"), C(e, "class", "svelte-43sxxs"), Je(
1214
  e,
1215
  "margin",
1216
  /*margin*/
1217
+ l[0]
1218
  );
1219
  },
1220
+ m(m, y) {
1221
+ Pn(m, e, y), j(e, t), j(t, n), j(n, i), j(n, s), j(n, o), j(n, a), j(t, r), j(r, f), j(r, u), j(r, c), j(r, p);
1222
  },
1223
+ p(m, [y]) {
1224
+ y & /*$top*/
1225
+ 2 && ge(n, "transform", "translate(" + /*$top*/
1226
  m[1][0] + "px, " + /*$top*/
1227
+ m[1][1] + "px)"), y & /*$bottom*/
1228
  4 && ge(r, "transform", "translate(" + /*$bottom*/
1229
  m[2][0] + "px, " + /*$bottom*/
1230
+ m[2][1] + "px)"), y & /*margin*/
1231
+ 1 && Je(
1232
  e,
1233
  "margin",
1234
  /*margin*/
1235
  m[0]
1236
  );
1237
  },
1238
+ i: Ue,
1239
+ o: Ue,
1240
  d(m) {
1241
+ m && In(e);
1242
  }
1243
  };
1244
  }
1245
+ function Hn(l, e, t) {
1246
+ let n, i;
1247
+ var s = this && this.__awaiter || function(m, y, L, v) {
1248
+ function F(d) {
1249
+ return d instanceof L ? d : new L(function(_) {
1250
+ _(d);
1251
  });
1252
  }
1253
+ return new (L || (L = Promise))(function(d, _) {
1254
+ function q(g) {
1255
  try {
1256
+ b(v.next(g));
1257
+ } catch (O) {
1258
+ _(O);
1259
  }
1260
  }
1261
+ function z(g) {
1262
  try {
1263
+ b(v.throw(g));
1264
+ } catch (O) {
1265
+ _(O);
1266
  }
1267
  }
1268
+ function b(g) {
1269
+ g.done ? d(g.value) : F(g.value).then(q, z);
1270
  }
1271
+ b((v = v.apply(m, y || [])).next());
1272
  });
1273
  };
1274
  let { margin: o = !0 } = e;
1275
+ const a = Oe([0, 0]);
1276
+ Te(l, a, (m) => t(1, n = m));
1277
+ const r = Oe([0, 0]);
1278
+ Te(l, r, (m) => t(2, i = m));
1279
  let f;
1280
  function u() {
1281
  return s(this, void 0, void 0, function* () {
1282
  yield Promise.all([a.set([125, 140]), r.set([-125, -140])]), yield Promise.all([a.set([-125, 140]), r.set([125, -140])]), yield Promise.all([a.set([-125, 0]), r.set([125, -0])]), yield Promise.all([a.set([125, 0]), r.set([-125, 0])]);
1283
  });
1284
  }
1285
+ function c() {
1286
  return s(this, void 0, void 0, function* () {
1287
+ yield u(), f || c();
1288
  });
1289
  }
1290
+ function p() {
1291
  return s(this, void 0, void 0, function* () {
1292
+ yield Promise.all([a.set([125, 0]), r.set([-125, 0])]), c();
1293
  });
1294
  }
1295
+ return Bn(() => (p(), () => f = !0)), l.$$set = (m) => {
1296
  "margin" in m && t(0, o = m.margin);
1297
+ }, [o, n, i, a, r];
1298
  }
1299
+ class On extends An {
1300
  constructor(e) {
1301
+ super(), Zn(this, e, Hn, Dn, Wn, { margin: 0 });
1302
  }
1303
  }
1304
  const {
1305
+ SvelteComponent: Tn,
1306
+ append: G,
1307
  attr: P,
1308
+ binding_callbacks: Re,
1309
  check_outros: pt,
1310
  create_component: yt,
1311
+ create_slot: Un,
1312
  destroy_component: vt,
1313
  destroy_each: qt,
1314
+ detach: w,
1315
  element: H,
1316
  empty: se,
1317
  ensure_array_like: pe,
1318
+ get_all_dirty_from_scope: Jn,
1319
+ get_slot_changes: Rn,
1320
  group_outros: Ct,
1321
+ init: Xn,
1322
+ insert: k,
1323
  mount_component: Ft,
1324
+ noop: Ve,
1325
+ safe_not_equal: Yn,
1326
  set_data: A,
1327
+ set_style: J,
1328
  space: W,
1329
+ text: S,
1330
+ toggle_class: E,
1331
  transition_in: K,
1332
  transition_out: Q,
1333
+ update_slot_base: Gn
1334
+ } = window.__gradio__svelte__internal, { tick: Kn } = window.__gradio__svelte__internal, { onDestroy: Qn } = window.__gradio__svelte__internal, { createEventDispatcher: xn } = window.__gradio__svelte__internal, $n = (l) => ({}), Xe = (l) => ({});
1335
+ function Ye(l, e, t) {
1336
+ const n = l.slice();
1337
+ return n[41] = e[t], n[43] = t, n;
1338
  }
1339
+ function Ge(l, e, t) {
1340
+ const n = l.slice();
1341
+ return n[41] = e[t], n;
1342
  }
1343
+ function el(l) {
1344
+ let e, t, n, i, s = (
1345
  /*i18n*/
1346
+ l[1]("common.error") + ""
1347
  ), o, a, r;
1348
+ t = new yn({
1349
  props: {
1350
+ Icon: zn,
1351
  label: (
1352
  /*i18n*/
1353
+ l[1]("common.clear")
1354
  ),
1355
  disabled: !1
1356
  }
1357
  }), t.$on(
1358
  "click",
1359
  /*click_handler*/
1360
+ l[32]
1361
  );
1362
  const f = (
1363
  /*#slots*/
1364
+ l[30].error
1365
+ ), u = Un(
1366
  f,
1367
+ l,
1368
  /*$$scope*/
1369
+ l[29],
1370
+ Xe
1371
  );
1372
  return {
1373
  c() {
1374
+ e = H("div"), yt(t.$$.fragment), n = W(), i = H("span"), o = S(s), a = W(), u && u.c(), P(e, "class", "clear-status svelte-1yk38uw"), P(i, "class", "error svelte-1yk38uw");
1375
  },
1376
+ m(c, p) {
1377
+ k(c, e, p), Ft(t, e, null), k(c, n, p), k(c, i, p), G(i, o), k(c, a, p), u && u.m(c, p), r = !0;
1378
  },
1379
+ p(c, p) {
1380
  const m = {};
1381
+ p[0] & /*i18n*/
1382
  2 && (m.label = /*i18n*/
1383
+ c[1]("common.clear")), t.$set(m), (!r || p[0] & /*i18n*/
1384
  2) && s !== (s = /*i18n*/
1385
+ c[1]("common.error") + "") && A(o, s), u && u.p && (!r || p[0] & /*$$scope*/
1386
+ 536870912) && Gn(
1387
  u,
1388
  f,
1389
+ c,
1390
  /*$$scope*/
1391
+ c[29],
1392
+ r ? Rn(
1393
  f,
1394
  /*$$scope*/
1395
+ c[29],
1396
+ p,
1397
+ $n
1398
+ ) : Jn(
1399
  /*$$scope*/
1400
+ c[29]
1401
  ),
1402
+ Xe
1403
  );
1404
  },
1405
+ i(c) {
1406
+ r || (K(t.$$.fragment, c), K(u, c), r = !0);
1407
  },
1408
+ o(c) {
1409
+ Q(t.$$.fragment, c), Q(u, c), r = !1;
1410
  },
1411
+ d(c) {
1412
+ c && (w(e), w(n), w(i), w(a)), vt(t), u && u.d(c);
1413
  }
1414
  };
1415
  }
1416
+ function tl(l) {
1417
+ let e, t, n, i, s, o, a, r, f, u = (
1418
  /*variant*/
1419
+ l[8] === "default" && /*show_eta_bar*/
1420
+ l[18] && /*show_progress*/
1421
+ l[6] === "full" && Ke(l)
1422
  );
1423
+ function c(_, q) {
1424
  if (
1425
  /*progress*/
1426
+ _[7]
1427
  )
1428
+ return il;
1429
  if (
1430
  /*queue_position*/
1431
+ _[2] !== null && /*queue_size*/
1432
+ _[3] !== void 0 && /*queue_position*/
1433
+ _[2] >= 0
1434
  )
1435
+ return ll;
1436
  if (
1437
  /*queue_position*/
1438
+ _[2] === 0
1439
  )
1440
+ return nl;
1441
  }
1442
+ let p = c(l), m = p && p(l), y = (
1443
  /*timer*/
1444
+ l[5] && $e(l)
1445
  );
1446
+ const L = [rl, ol], v = [];
1447
+ function F(_, q) {
1448
  return (
1449
  /*last_progress_level*/
1450
+ _[15] != null ? 0 : (
1451
  /*show_progress*/
1452
+ _[6] === "full" ? 1 : -1
1453
  )
1454
  );
1455
  }
1456
+ ~(s = F(l)) && (o = v[s] = L[s](l));
1457
  let d = !/*timer*/
1458
+ l[5] && ft(l);
1459
  return {
1460
  c() {
1461
+ u && u.c(), e = W(), t = H("div"), m && m.c(), n = W(), y && y.c(), i = W(), o && o.c(), a = W(), d && d.c(), r = se(), P(t, "class", "progress-text svelte-1yk38uw"), E(
1462
  t,
1463
  "meta-text-center",
1464
  /*variant*/
1465
+ l[8] === "center"
1466
+ ), E(
1467
  t,
1468
  "meta-text",
1469
  /*variant*/
1470
+ l[8] === "default"
1471
  );
1472
  },
1473
+ m(_, q) {
1474
+ u && u.m(_, q), k(_, e, q), k(_, t, q), m && m.m(t, null), G(t, n), y && y.m(t, null), k(_, i, q), ~s && v[s].m(_, q), k(_, a, q), d && d.m(_, q), k(_, r, q), f = !0;
1475
  },
1476
+ p(_, q) {
1477
  /*variant*/
1478
+ _[8] === "default" && /*show_eta_bar*/
1479
+ _[18] && /*show_progress*/
1480
+ _[6] === "full" ? u ? u.p(_, q) : (u = Ke(_), u.c(), u.m(e.parentNode, e)) : u && (u.d(1), u = null), p === (p = c(_)) && m ? m.p(_, q) : (m && m.d(1), m = p && p(_), m && (m.c(), m.m(t, n))), /*timer*/
1481
+ _[5] ? y ? y.p(_, q) : (y = $e(_), y.c(), y.m(t, null)) : y && (y.d(1), y = null), (!f || q[0] & /*variant*/
1482
+ 256) && E(
1483
  t,
1484
  "meta-text-center",
1485
  /*variant*/
1486
+ _[8] === "center"
1487
  ), (!f || q[0] & /*variant*/
1488
+ 256) && E(
1489
  t,
1490
  "meta-text",
1491
  /*variant*/
1492
+ _[8] === "default"
1493
  );
1494
  let z = s;
1495
+ s = F(_), s === z ? ~s && v[s].p(_, q) : (o && (Ct(), Q(v[z], 1, 1, () => {
1496
+ v[z] = null;
1497
+ }), pt()), ~s ? (o = v[s], o ? o.p(_, q) : (o = v[s] = L[s](_), o.c()), K(o, 1), o.m(a.parentNode, a)) : o = null), /*timer*/
1498
+ _[5] ? d && (d.d(1), d = null) : d ? d.p(_, q) : (d = ft(_), d.c(), d.m(r.parentNode, r));
1499
  },
1500
+ i(_) {
1501
  f || (K(o), f = !0);
1502
  },
1503
+ o(_) {
1504
  Q(o), f = !1;
1505
  },
1506
+ d(_) {
1507
+ _ && (w(e), w(t), w(i), w(a), w(r)), u && u.d(_), m && m.d(), y && y.d(), ~s && v[s].d(_), d && d.d(_);
1508
  }
1509
  };
1510
  }
1511
+ function Ke(l) {
1512
  let e, t = `translateX(${/*eta_level*/
1513
+ (l[17] || 0) * 100 - 100}%)`;
1514
  return {
1515
  c() {
1516
+ e = H("div"), P(e, "class", "eta-bar svelte-1yk38uw"), J(e, "transform", t);
1517
  },
1518
+ m(n, i) {
1519
+ k(n, e, i);
1520
  },
1521
+ p(n, i) {
1522
  i[0] & /*eta_level*/
1523
  131072 && t !== (t = `translateX(${/*eta_level*/
1524
+ (n[17] || 0) * 100 - 100}%)`) && J(e, "transform", t);
1525
  },
1526
+ d(n) {
1527
+ n && w(e);
1528
  }
1529
  };
1530
  }
1531
+ function nl(l) {
1532
  let e;
1533
  return {
1534
  c() {
1535
+ e = S("processing |");
1536
  },
1537
+ m(t, n) {
1538
+ k(t, e, n);
1539
  },
1540
+ p: Ve,
1541
  d(t) {
1542
+ t && w(e);
1543
  }
1544
  };
1545
  }
1546
+ function ll(l) {
1547
  let e, t = (
1548
  /*queue_position*/
1549
+ l[2] + 1 + ""
1550
+ ), n, i, s, o;
1551
  return {
1552
  c() {
1553
+ e = S("queue: "), n = S(t), i = S("/"), s = S(
1554
  /*queue_size*/
1555
+ l[3]
1556
+ ), o = S(" |");
1557
  },
1558
  m(a, r) {
1559
+ k(a, e, r), k(a, n, r), k(a, i, r), k(a, s, r), k(a, o, r);
1560
  },
1561
  p(a, r) {
1562
  r[0] & /*queue_position*/
1563
  4 && t !== (t = /*queue_position*/
1564
+ a[2] + 1 + "") && A(n, t), r[0] & /*queue_size*/
1565
  8 && A(
1566
  s,
1567
  /*queue_size*/
 
1569
  );
1570
  },
1571
  d(a) {
1572
+ a && (w(e), w(n), w(i), w(s), w(o));
1573
  }
1574
  };
1575
  }
1576
+ function il(l) {
1577
  let e, t = pe(
1578
  /*progress*/
1579
+ l[7]
1580
+ ), n = [];
1581
  for (let i = 0; i < t.length; i += 1)
1582
+ n[i] = xe(Ge(l, t, i));
1583
  return {
1584
  c() {
1585
+ for (let i = 0; i < n.length; i += 1)
1586
+ n[i].c();
1587
  e = se();
1588
  },
1589
  m(i, s) {
1590
+ for (let o = 0; o < n.length; o += 1)
1591
+ n[o] && n[o].m(i, s);
1592
+ k(i, e, s);
1593
  },
1594
  p(i, s) {
1595
  if (s[0] & /*progress*/
 
1600
  );
1601
  let o;
1602
  for (o = 0; o < t.length; o += 1) {
1603
+ const a = Ge(i, t, o);
1604
+ n[o] ? n[o].p(a, s) : (n[o] = xe(a), n[o].c(), n[o].m(e.parentNode, e));
1605
  }
1606
+ for (; o < n.length; o += 1)
1607
+ n[o].d(1);
1608
+ n.length = t.length;
1609
  }
1610
  },
1611
  d(i) {
1612
+ i && w(e), qt(n, i);
1613
  }
1614
  };
1615
  }
1616
+ function Qe(l) {
1617
  let e, t = (
1618
  /*p*/
1619
+ l[41].unit + ""
1620
+ ), n, i, s = " ", o;
1621
+ function a(u, c) {
1622
  return (
1623
  /*p*/
1624
+ u[41].length != null ? fl : sl
1625
  );
1626
  }
1627
+ let r = a(l), f = r(l);
1628
  return {
1629
  c() {
1630
+ f.c(), e = W(), n = S(t), i = S(" | "), o = S(s);
1631
  },
1632
+ m(u, c) {
1633
+ f.m(u, c), k(u, e, c), k(u, n, c), k(u, i, c), k(u, o, c);
1634
  },
1635
+ p(u, c) {
1636
+ r === (r = a(u)) && f ? f.p(u, c) : (f.d(1), f = r(u), f && (f.c(), f.m(e.parentNode, e))), c[0] & /*progress*/
1637
  128 && t !== (t = /*p*/
1638
+ u[41].unit + "") && A(n, t);
1639
  },
1640
  d(u) {
1641
+ u && (w(e), w(n), w(i), w(o)), f.d(u);
1642
  }
1643
  };
1644
  }
1645
+ function sl(l) {
1646
+ let e = le(
1647
  /*p*/
1648
+ l[41].index || 0
1649
  ) + "", t;
1650
  return {
1651
  c() {
1652
+ t = S(e);
1653
  },
1654
+ m(n, i) {
1655
+ k(n, t, i);
1656
  },
1657
+ p(n, i) {
1658
  i[0] & /*progress*/
1659
+ 128 && e !== (e = le(
1660
  /*p*/
1661
+ n[41].index || 0
1662
  ) + "") && A(t, e);
1663
  },
1664
+ d(n) {
1665
+ n && w(t);
1666
  }
1667
  };
1668
  }
1669
+ function fl(l) {
1670
+ let e = le(
1671
  /*p*/
1672
+ l[41].index || 0
1673
+ ) + "", t, n, i = le(
1674
  /*p*/
1675
+ l[41].length
1676
  ) + "", s;
1677
  return {
1678
  c() {
1679
+ t = S(e), n = S("/"), s = S(i);
1680
  },
1681
  m(o, a) {
1682
+ k(o, t, a), k(o, n, a), k(o, s, a);
1683
  },
1684
  p(o, a) {
1685
  a[0] & /*progress*/
1686
+ 128 && e !== (e = le(
1687
  /*p*/
1688
  o[41].index || 0
1689
  ) + "") && A(t, e), a[0] & /*progress*/
1690
+ 128 && i !== (i = le(
1691
  /*p*/
1692
  o[41].length
1693
  ) + "") && A(s, i);
1694
  },
1695
  d(o) {
1696
+ o && (w(t), w(n), w(s));
1697
  }
1698
  };
1699
  }
1700
+ function xe(l) {
1701
  let e, t = (
1702
  /*p*/
1703
+ l[41].index != null && Qe(l)
1704
  );
1705
  return {
1706
  c() {
1707
  t && t.c(), e = se();
1708
  },
1709
+ m(n, i) {
1710
+ t && t.m(n, i), k(n, e, i);
1711
  },
1712
+ p(n, i) {
1713
  /*p*/
1714
+ n[41].index != null ? t ? t.p(n, i) : (t = Qe(n), t.c(), t.m(e.parentNode, e)) : t && (t.d(1), t = null);
1715
  },
1716
+ d(n) {
1717
+ n && w(e), t && t.d(n);
1718
  }
1719
  };
1720
  }
1721
+ function $e(l) {
1722
  let e, t = (
1723
  /*eta*/
1724
+ l[0] ? `/${/*formatted_eta*/
1725
+ l[19]}` : ""
1726
+ ), n, i;
1727
  return {
1728
  c() {
1729
+ e = S(
1730
  /*formatted_timer*/
1731
+ l[20]
1732
+ ), n = S(t), i = S("s");
1733
  },
1734
  m(s, o) {
1735
+ k(s, e, o), k(s, n, o), k(s, i, o);
1736
  },
1737
  p(s, o) {
1738
  o[0] & /*formatted_timer*/
 
1743
  ), o[0] & /*eta, formatted_eta*/
1744
  524289 && t !== (t = /*eta*/
1745
  s[0] ? `/${/*formatted_eta*/
1746
+ s[19]}` : "") && A(n, t);
1747
  },
1748
  d(s) {
1749
+ s && (w(e), w(n), w(i));
1750
  }
1751
  };
1752
  }
1753
+ function ol(l) {
1754
  let e, t;
1755
+ return e = new On({
1756
  props: { margin: (
1757
  /*variant*/
1758
+ l[8] === "default"
1759
  ) }
1760
  }), {
1761
  c() {
1762
  yt(e.$$.fragment);
1763
  },
1764
+ m(n, i) {
1765
+ Ft(e, n, i), t = !0;
1766
  },
1767
+ p(n, i) {
1768
  const s = {};
1769
  i[0] & /*variant*/
1770
  256 && (s.margin = /*variant*/
1771
+ n[8] === "default"), e.$set(s);
1772
  },
1773
+ i(n) {
1774
+ t || (K(e.$$.fragment, n), t = !0);
1775
  },
1776
+ o(n) {
1777
+ Q(e.$$.fragment, n), t = !1;
1778
  },
1779
+ d(n) {
1780
+ vt(e, n);
1781
  }
1782
  };
1783
  }
1784
+ function rl(l) {
1785
+ let e, t, n, i, s, o = `${/*last_progress_level*/
1786
+ l[15] * 100}%`, a = (
1787
  /*progress*/
1788
+ l[7] != null && et(l)
1789
  );
1790
  return {
1791
  c() {
1792
+ e = H("div"), t = H("div"), a && a.c(), n = W(), i = H("div"), s = H("div"), P(t, "class", "progress-level-inner svelte-1yk38uw"), P(s, "class", "progress-bar svelte-1yk38uw"), J(s, "width", o), P(i, "class", "progress-bar-wrap svelte-1yk38uw"), P(e, "class", "progress-level svelte-1yk38uw");
1793
  },
1794
  m(r, f) {
1795
+ k(r, e, f), G(e, t), a && a.m(t, null), G(e, n), G(e, i), G(i, s), l[31](s);
1796
  },
1797
  p(r, f) {
1798
  /*progress*/
1799
  r[7] != null ? a ? a.p(r, f) : (a = et(r), a.c(), a.m(t, null)) : a && (a.d(1), a = null), f[0] & /*last_progress_level*/
1800
  32768 && o !== (o = `${/*last_progress_level*/
1801
+ r[15] * 100}%`) && J(s, "width", o);
1802
  },
1803
+ i: Ve,
1804
+ o: Ve,
1805
  d(r) {
1806
+ r && w(e), a && a.d(), l[31](null);
1807
  }
1808
  };
1809
  }
1810
+ function et(l) {
1811
  let e, t = pe(
1812
  /*progress*/
1813
+ l[7]
1814
+ ), n = [];
1815
  for (let i = 0; i < t.length; i += 1)
1816
+ n[i] = st(Ye(l, t, i));
1817
  return {
1818
  c() {
1819
+ for (let i = 0; i < n.length; i += 1)
1820
+ n[i].c();
1821
  e = se();
1822
  },
1823
  m(i, s) {
1824
+ for (let o = 0; o < n.length; o += 1)
1825
+ n[o] && n[o].m(i, s);
1826
+ k(i, e, s);
1827
  },
1828
  p(i, s) {
1829
  if (s[0] & /*progress_level, progress*/
 
1834
  );
1835
  let o;
1836
  for (o = 0; o < t.length; o += 1) {
1837
+ const a = Ye(i, t, o);
1838
+ n[o] ? n[o].p(a, s) : (n[o] = st(a), n[o].c(), n[o].m(e.parentNode, e));
1839
  }
1840
+ for (; o < n.length; o += 1)
1841
+ n[o].d(1);
1842
+ n.length = t.length;
1843
  }
1844
  },
1845
  d(i) {
1846
+ i && w(e), qt(n, i);
1847
  }
1848
  };
1849
  }
1850
+ function tt(l) {
1851
+ let e, t, n, i, s = (
1852
  /*i*/
1853
+ l[43] !== 0 && al()
1854
  ), o = (
1855
  /*p*/
1856
+ l[41].desc != null && nt(l)
1857
  ), a = (
1858
  /*p*/
1859
+ l[41].desc != null && /*progress_level*/
1860
+ l[14] && /*progress_level*/
1861
+ l[14][
1862
  /*i*/
1863
+ l[43]
1864
+ ] != null && lt()
1865
  ), r = (
1866
  /*progress_level*/
1867
+ l[14] != null && it(l)
1868
  );
1869
  return {
1870
  c() {
1871
+ s && s.c(), e = W(), o && o.c(), t = W(), a && a.c(), n = W(), r && r.c(), i = se();
1872
  },
1873
  m(f, u) {
1874
+ s && s.m(f, u), k(f, e, u), o && o.m(f, u), k(f, t, u), a && a.m(f, u), k(f, n, u), r && r.m(f, u), k(f, i, u);
1875
  },
1876
  p(f, u) {
1877
  /*p*/
1878
+ f[41].desc != null ? o ? o.p(f, u) : (o = nt(f), o.c(), o.m(t.parentNode, t)) : o && (o.d(1), o = null), /*p*/
1879
  f[41].desc != null && /*progress_level*/
1880
  f[14] && /*progress_level*/
1881
  f[14][
1882
  /*i*/
1883
  f[43]
1884
+ ] != null ? a || (a = lt(), a.c(), a.m(n.parentNode, n)) : a && (a.d(1), a = null), /*progress_level*/
1885
  f[14] != null ? r ? r.p(f, u) : (r = it(f), r.c(), r.m(i.parentNode, i)) : r && (r.d(1), r = null);
1886
  },
1887
  d(f) {
1888
+ f && (w(e), w(t), w(n), w(i)), s && s.d(f), o && o.d(f), a && a.d(f), r && r.d(f);
1889
  }
1890
  };
1891
  }
1892
+ function al(l) {
1893
  let e;
1894
  return {
1895
  c() {
1896
+ e = S(" /");
1897
  },
1898
+ m(t, n) {
1899
+ k(t, e, n);
1900
  },
1901
  d(t) {
1902
+ t && w(e);
1903
  }
1904
  };
1905
  }
1906
+ function nt(l) {
1907
  let e = (
1908
  /*p*/
1909
+ l[41].desc + ""
1910
  ), t;
1911
  return {
1912
  c() {
1913
+ t = S(e);
1914
  },
1915
+ m(n, i) {
1916
+ k(n, t, i);
1917
  },
1918
+ p(n, i) {
1919
  i[0] & /*progress*/
1920
  128 && e !== (e = /*p*/
1921
+ n[41].desc + "") && A(t, e);
1922
  },
1923
+ d(n) {
1924
+ n && w(t);
1925
  }
1926
  };
1927
  }
1928
+ function lt(l) {
1929
  let e;
1930
  return {
1931
  c() {
1932
+ e = S("-");
1933
  },
1934
+ m(t, n) {
1935
+ k(t, e, n);
1936
  },
1937
  d(t) {
1938
+ t && w(e);
1939
  }
1940
  };
1941
  }
1942
+ function it(l) {
1943
  let e = (100 * /*progress_level*/
1944
+ (l[14][
1945
  /*i*/
1946
+ l[43]
1947
+ ] || 0)).toFixed(1) + "", t, n;
1948
  return {
1949
  c() {
1950
+ t = S(e), n = S("%");
1951
  },
1952
  m(i, s) {
1953
+ k(i, t, s), k(i, n, s);
1954
  },
1955
  p(i, s) {
1956
  s[0] & /*progress_level*/
 
1961
  ] || 0)).toFixed(1) + "") && A(t, e);
1962
  },
1963
  d(i) {
1964
+ i && (w(t), w(n));
1965
  }
1966
  };
1967
  }
1968
+ function st(l) {
1969
  let e, t = (
1970
  /*p*/
1971
+ (l[41].desc != null || /*progress_level*/
1972
+ l[14] && /*progress_level*/
1973
+ l[14][
1974
  /*i*/
1975
+ l[43]
1976
+ ] != null) && tt(l)
1977
  );
1978
  return {
1979
  c() {
1980
  t && t.c(), e = se();
1981
  },
1982
+ m(n, i) {
1983
+ t && t.m(n, i), k(n, e, i);
1984
  },
1985
+ p(n, i) {
1986
  /*p*/
1987
+ n[41].desc != null || /*progress_level*/
1988
+ n[14] && /*progress_level*/
1989
+ n[14][
1990
  /*i*/
1991
+ n[43]
1992
+ ] != null ? t ? t.p(n, i) : (t = tt(n), t.c(), t.m(e.parentNode, e)) : t && (t.d(1), t = null);
1993
  },
1994
+ d(n) {
1995
+ n && w(e), t && t.d(n);
1996
  }
1997
  };
1998
  }
1999
+ function ft(l) {
2000
  let e, t;
2001
  return {
2002
  c() {
2003
+ e = H("p"), t = S(
2004
  /*loading_text*/
2005
+ l[9]
2006
  ), P(e, "class", "loading svelte-1yk38uw");
2007
  },
2008
+ m(n, i) {
2009
+ k(n, e, i), G(e, t);
2010
  },
2011
+ p(n, i) {
2012
  i[0] & /*loading_text*/
2013
  512 && A(
2014
  t,
2015
  /*loading_text*/
2016
+ n[9]
2017
  );
2018
  },
2019
+ d(n) {
2020
+ n && w(e);
2021
  }
2022
  };
2023
  }
2024
+ function ul(l) {
2025
+ let e, t, n, i, s;
2026
+ const o = [tl, el], a = [];
2027
  function r(f, u) {
2028
  return (
2029
  /*status*/
 
2033
  )
2034
  );
2035
  }
2036
+ return ~(t = r(l)) && (n = a[t] = o[t](l)), {
2037
  c() {
2038
+ e = H("div"), n && n.c(), P(e, "class", i = "wrap " + /*variant*/
2039
+ l[8] + " " + /*show_progress*/
2040
+ l[6] + " svelte-1yk38uw"), E(e, "hide", !/*status*/
2041
+ l[4] || /*status*/
2042
+ l[4] === "complete" || /*show_progress*/
2043
+ l[6] === "hidden"), E(
2044
  e,
2045
  "translucent",
2046
  /*variant*/
2047
+ l[8] === "center" && /*status*/
2048
+ (l[4] === "pending" || /*status*/
2049
+ l[4] === "error") || /*translucent*/
2050
+ l[11] || /*show_progress*/
2051
+ l[6] === "minimal"
2052
+ ), E(
2053
  e,
2054
  "generating",
2055
  /*status*/
2056
+ l[4] === "generating"
2057
+ ), E(
2058
  e,
2059
  "border",
2060
  /*border*/
2061
+ l[12]
2062
+ ), J(
2063
  e,
2064
  "position",
2065
  /*absolute*/
2066
+ l[10] ? "absolute" : "static"
2067
+ ), J(
2068
  e,
2069
  "padding",
2070
  /*absolute*/
2071
+ l[10] ? "0" : "var(--size-8) 0"
2072
  );
2073
  },
2074
  m(f, u) {
2075
+ k(f, e, u), ~t && a[t].m(e, null), l[33](e), s = !0;
2076
  },
2077
  p(f, u) {
2078
+ let c = t;
2079
+ t = r(f), t === c ? ~t && a[t].p(f, u) : (n && (Ct(), Q(a[c], 1, 1, () => {
2080
+ a[c] = null;
2081
+ }), pt()), ~t ? (n = a[t], n ? n.p(f, u) : (n = a[t] = o[t](f), n.c()), K(n, 1), n.m(e, null)) : n = null), (!s || u[0] & /*variant, show_progress*/
2082
  320 && i !== (i = "wrap " + /*variant*/
2083
  f[8] + " " + /*show_progress*/
2084
  f[6] + " svelte-1yk38uw")) && P(e, "class", i), (!s || u[0] & /*variant, show_progress, status, show_progress*/
2085
+ 336) && E(e, "hide", !/*status*/
2086
  f[4] || /*status*/
2087
  f[4] === "complete" || /*show_progress*/
2088
  f[6] === "hidden"), (!s || u[0] & /*variant, show_progress, variant, status, translucent, show_progress*/
2089
+ 2384) && E(
2090
  e,
2091
  "translucent",
2092
  /*variant*/
 
2096
  f[11] || /*show_progress*/
2097
  f[6] === "minimal"
2098
  ), (!s || u[0] & /*variant, show_progress, status*/
2099
+ 336) && E(
2100
  e,
2101
  "generating",
2102
  /*status*/
2103
  f[4] === "generating"
2104
  ), (!s || u[0] & /*variant, show_progress, border*/
2105
+ 4416) && E(
2106
  e,
2107
  "border",
2108
  /*border*/
2109
  f[12]
2110
  ), u[0] & /*absolute*/
2111
+ 1024 && J(
2112
  e,
2113
  "position",
2114
  /*absolute*/
2115
  f[10] ? "absolute" : "static"
2116
  ), u[0] & /*absolute*/
2117
+ 1024 && J(
2118
  e,
2119
  "padding",
2120
  /*absolute*/
 
2122
  );
2123
  },
2124
  i(f) {
2125
+ s || (K(n), s = !0);
2126
  },
2127
  o(f) {
2128
+ Q(n), s = !1;
2129
  },
2130
  d(f) {
2131
+ f && w(e), ~t && a[t].d(), l[33](null);
2132
  }
2133
  };
2134
  }
2135
+ var cl = function(l, e, t, n) {
2136
  function i(s) {
2137
  return s instanceof t ? s : new t(function(o) {
2138
  o(s);
 
2141
  return new (t || (t = Promise))(function(s, o) {
2142
  function a(u) {
2143
  try {
2144
+ f(n.next(u));
2145
+ } catch (c) {
2146
+ o(c);
2147
  }
2148
  }
2149
  function r(u) {
2150
  try {
2151
+ f(n.throw(u));
2152
+ } catch (c) {
2153
+ o(c);
2154
  }
2155
  }
2156
  function f(u) {
2157
  u.done ? s(u.value) : i(u.value).then(a, r);
2158
  }
2159
+ f((n = n.apply(l, e || [])).next());
2160
  });
2161
  };
2162
  let we = [], Le = !1;
2163
+ function _l(l) {
2164
+ return cl(this, arguments, void 0, function* (e, t = !0) {
2165
  if (!(window.__gradio_mode__ === "website" || window.__gradio_mode__ !== "app" && t !== !0)) {
2166
  if (we.push(e), !Le)
2167
  Le = !0;
2168
  else
2169
  return;
2170
+ yield Kn(), requestAnimationFrame(() => {
2171
+ let n = [0, 0];
2172
  for (let i = 0; i < we.length; i++) {
2173
  const o = we[i].getBoundingClientRect();
2174
+ (i === 0 || o.top + window.scrollY <= n[0]) && (n[0] = o.top + window.scrollY, n[1] = i);
2175
  }
2176
+ window.scrollTo({ top: n[0] - 20, behavior: "smooth" }), Le = !1, we = [];
2177
  });
2178
  }
2179
  });
2180
  }
2181
+ function dl(l, e, t) {
2182
+ let n, { $$slots: i = {}, $$scope: s } = e;
2183
  this && this.__awaiter;
2184
+ const o = xn();
2185
+ let { i18n: a } = e, { eta: r = null } = e, { queue_position: f } = e, { queue_size: u } = e, { status: c } = e, { scroll_to_output: p = !1 } = e, { timer: m = !0 } = e, { show_progress: y = "full" } = e, { message: L = null } = e, { progress: v = null } = e, { variant: F = "default" } = e, { loading_text: d = "Loading..." } = e, { absolute: _ = !0 } = e, { translucent: q = !1 } = e, { border: z = !1 } = e, { autoscroll: b } = e, g, O = !1, ue = 0, R = 0, x = null, $ = null, Ae = 0, X = null, fe, U = null, Ie = !0;
2186
  const Nt = () => {
2187
+ t(0, r = t(27, x = t(19, ce = null))), t(25, ue = performance.now()), t(26, R = 0), O = !0, je();
2188
  };
2189
+ function je() {
2190
  requestAnimationFrame(() => {
2191
+ t(26, R = (performance.now() - ue) / 1e3), O && je();
2192
  });
2193
  }
2194
  function Ze() {
2195
+ t(26, R = 0), t(0, r = t(27, x = t(19, ce = null))), O && (O = !1);
2196
  }
2197
+ Qn(() => {
2198
+ O && Ze();
2199
  });
2200
  let ce = null;
2201
+ function Et(h) {
2202
+ Re[h ? "unshift" : "push"](() => {
2203
+ U = h, t(16, U), t(7, v), t(14, X), t(15, fe);
2204
  });
2205
  }
2206
+ const At = () => {
2207
  o("clear_status");
2208
  };
2209
+ function It(h) {
2210
+ Re[h ? "unshift" : "push"](() => {
2211
+ g = h, t(13, g);
2212
  });
2213
  }
2214
+ return l.$$set = (h) => {
2215
+ "i18n" in h && t(1, a = h.i18n), "eta" in h && t(0, r = h.eta), "queue_position" in h && t(2, f = h.queue_position), "queue_size" in h && t(3, u = h.queue_size), "status" in h && t(4, c = h.status), "scroll_to_output" in h && t(22, p = h.scroll_to_output), "timer" in h && t(5, m = h.timer), "show_progress" in h && t(6, y = h.show_progress), "message" in h && t(23, L = h.message), "progress" in h && t(7, v = h.progress), "variant" in h && t(8, F = h.variant), "loading_text" in h && t(9, d = h.loading_text), "absolute" in h && t(10, _ = h.absolute), "translucent" in h && t(11, q = h.translucent), "border" in h && t(12, z = h.border), "autoscroll" in h && t(24, b = h.autoscroll), "$$scope" in h && t(29, s = h.$$scope);
2216
+ }, l.$$.update = () => {
2217
+ l.$$.dirty[0] & /*eta, old_eta, timer_start, eta_from_start*/
2218
+ 436207617 && (r === null && t(0, r = x), r != null && x !== r && (t(28, $ = (performance.now() - ue) / 1e3 + r), t(19, ce = $.toFixed(1)), t(27, x = r))), l.$$.dirty[0] & /*eta_from_start, timer_diff*/
2219
+ 335544320 && t(17, Ae = $ === null || $ <= 0 || !R ? null : Math.min(R / $, 1)), l.$$.dirty[0] & /*progress*/
2220
+ 128 && v != null && t(18, Ie = !1), l.$$.dirty[0] & /*progress, progress_level, progress_bar, last_progress_level*/
2221
+ 114816 && (v != null ? t(14, X = v.map((h) => {
2222
+ if (h.index != null && h.length != null)
2223
+ return h.index / h.length;
2224
+ if (h.progress != null)
2225
+ return h.progress;
2226
+ })) : t(14, X = null), X ? (t(15, fe = X[X.length - 1]), U && (fe === 0 ? t(16, U.style.transition = "0", U) : t(16, U.style.transition = "150ms", U))) : t(15, fe = void 0)), l.$$.dirty[0] & /*status*/
2227
+ 16 && (c === "pending" ? Nt() : Ze()), l.$$.dirty[0] & /*el, scroll_to_output, status, autoscroll*/
2228
+ 20979728 && g && p && (c === "pending" || c === "complete") && _l(g, b), l.$$.dirty[0] & /*status, message*/
2229
+ 8388624, l.$$.dirty[0] & /*timer_diff*/
2230
+ 67108864 && t(20, n = R.toFixed(1));
2231
  }, [
2232
  r,
2233
  a,
2234
  f,
2235
  u,
2236
+ c,
2237
  m,
 
2238
  y,
2239
+ v,
2240
+ F,
2241
  d,
2242
+ _,
2243
  q,
2244
  z,
2245
+ g,
 
 
2246
  X,
2247
+ fe,
2248
+ U,
2249
+ Ae,
2250
+ Ie,
2251
  ce,
2252
+ n,
2253
  o,
2254
+ p,
2255
+ L,
2256
+ b,
2257
  ue,
2258
+ R,
2259
  x,
2260
  $,
2261
  s,
2262
  i,
 
2263
  Et,
2264
+ At,
2265
+ It
2266
  ];
2267
  }
2268
+ class ml extends Tn {
2269
  constructor(e) {
2270
+ super(), Xn(
2271
  this,
2272
  e,
2273
+ dl,
2274
+ ul,
2275
+ Yn,
2276
  {
2277
  i18n: 1,
2278
  eta: 0,
 
2297
  }
2298
  }
2299
  const {
2300
+ SvelteComponent: hl,
2301
+ append: bl,
2302
  attr: re,
2303
  detach: Lt,
2304
  element: ot,
2305
+ empty: gl,
2306
+ init: wl,
2307
  insert: St,
2308
  noop: rt,
2309
+ safe_not_equal: kl,
2310
  src_url_equal: at,
2311
+ toggle_class: ne
2312
  } = window.__gradio__svelte__internal;
2313
+ function ut(l) {
2314
+ let e, t, n;
2315
  return {
2316
  c() {
2317
+ e = ot("div"), t = ot("img"), at(t.src, n = /*value*/
2318
+ l[0].url) || re(t, "src", n), re(t, "alt", ""), re(t, "class", "svelte-giydt1"), re(e, "class", "container svelte-giydt1"), ne(
2319
  e,
2320
  "table",
2321
  /*type*/
2322
+ l[1] === "table"
2323
+ ), ne(
2324
  e,
2325
  "gallery",
2326
  /*type*/
2327
+ l[1] === "gallery"
2328
+ ), ne(
2329
  e,
2330
  "selected",
2331
  /*selected*/
2332
+ l[2]
2333
  );
2334
  },
2335
  m(i, s) {
2336
+ St(i, e, s), bl(e, t);
2337
  },
2338
  p(i, s) {
2339
  s & /*value*/
2340
+ 1 && !at(t.src, n = /*value*/
2341
+ i[0].url) && re(t, "src", n), s & /*type*/
2342
+ 2 && ne(
2343
  e,
2344
  "table",
2345
  /*type*/
2346
  i[1] === "table"
2347
  ), s & /*type*/
2348
+ 2 && ne(
2349
  e,
2350
  "gallery",
2351
  /*type*/
2352
  i[1] === "gallery"
2353
  ), s & /*selected*/
2354
+ 4 && ne(
2355
  e,
2356
  "selected",
2357
  /*selected*/
 
2363
  }
2364
  };
2365
  }
2366
+ function pl(l) {
2367
  let e, t = (
2368
  /*value*/
2369
+ l[0] && ut(l)
2370
  );
2371
  return {
2372
  c() {
2373
+ t && t.c(), e = gl();
2374
  },
2375
+ m(n, i) {
2376
+ t && t.m(n, i), St(n, e, i);
2377
  },
2378
+ p(n, [i]) {
2379
  /*value*/
2380
+ n[0] ? t ? t.p(n, i) : (t = ut(n), t.c(), t.m(e.parentNode, e)) : t && (t.d(1), t = null);
2381
  },
2382
  i: rt,
2383
  o: rt,
2384
+ d(n) {
2385
+ n && Lt(e), t && t.d(n);
2386
  }
2387
  };
2388
  }
2389
+ function yl(l, e, t) {
2390
+ let { value: n } = e, { type: i } = e, { selected: s = !1 } = e;
2391
+ return l.$$set = (o) => {
2392
+ "value" in o && t(0, n = o.value), "type" in o && t(1, i = o.type), "selected" in o && t(2, s = o.selected);
2393
+ }, [n, i, s];
2394
  }
2395
+ class Bl extends hl {
2396
  constructor(e) {
2397
+ super(), wl(this, e, yl, pl, kl, { value: 0, type: 1, selected: 2 });
2398
  }
2399
  }
2400
  const {
2401
+ SvelteComponent: vl,
2402
+ assign: ql,
2403
+ attr: Cl,
2404
+ binding_callbacks: Fl,
2405
+ check_outros: Ll,
2406
+ create_component: zt,
2407
+ destroy_component: Mt,
2408
  detach: Ne,
2409
+ element: Sl,
2410
+ empty: zl,
2411
+ flush: N,
2412
+ get_spread_object: Ml,
2413
+ get_spread_update: Vl,
2414
+ group_outros: Nl,
2415
+ init: El,
2416
+ insert: Ee,
2417
+ mount_component: Vt,
2418
+ safe_not_equal: Al,
2419
  set_style: ct,
2420
+ space: Il,
2421
  transition_in: ae,
2422
  transition_out: ye
2423
+ } = window.__gradio__svelte__internal, { onMount: jl } = window.__gradio__svelte__internal;
2424
+ function _t(l) {
2425
  let e, t;
2426
+ return e = new sn({
2427
  props: {
2428
  visible: (
2429
  /*visible*/
2430
+ l[3]
2431
  ),
2432
  variant: "solid",
2433
  border_mode: (
2434
  /*dragging*/
2435
+ l[12] ? "focus" : "base"
2436
  ),
2437
  padding: !1,
2438
  elem_id: (
2439
  /*elem_id*/
2440
+ l[1]
2441
  ),
2442
  elem_classes: (
2443
  /*elem_classes*/
2444
+ l[2]
2445
  ),
2446
  allow_overflow: !1,
2447
  container: (
2448
  /*container*/
2449
+ l[4]
2450
  ),
2451
  scale: (
2452
  /*scale*/
2453
+ l[5]
2454
  ),
2455
  min_width: (
2456
  /*min_width*/
2457
+ l[6]
2458
  ),
2459
+ $$slots: { default: [Zl] },
2460
+ $$scope: { ctx: l }
2461
  }
2462
  }), {
2463
  c() {
2464
+ zt(e.$$.fragment);
2465
  },
2466
+ m(n, i) {
2467
+ Vt(e, n, i), t = !0;
2468
  },
2469
+ p(n, i) {
2470
  const s = {};
2471
  i & /*visible*/
2472
  8 && (s.visible = /*visible*/
2473
+ n[3]), i & /*elem_id*/
2474
  2 && (s.elem_id = /*elem_id*/
2475
+ n[1]), i & /*elem_classes*/
2476
  4 && (s.elem_classes = /*elem_classes*/
2477
+ n[2]), i & /*container*/
2478
  16 && (s.container = /*container*/
2479
+ n[4]), i & /*scale*/
2480
  32 && (s.scale = /*scale*/
2481
+ n[5]), i & /*min_width*/
2482
  64 && (s.min_width = /*min_width*/
2483
+ n[6]), i & /*$$scope, ref, height, gradio, patched_loading_status, loading_status*/
2484
+ 1052289 && (s.$$scope = { dirty: i, ctx: n }), e.$set(s);
2485
  },
2486
+ i(n) {
2487
+ t || (ae(e.$$.fragment, n), t = !0);
2488
  },
2489
+ o(n) {
2490
+ ye(e.$$.fragment, n), t = !1;
2491
  },
2492
+ d(n) {
2493
+ Mt(e, n);
2494
  }
2495
  };
2496
  }
2497
+ function Zl(l) {
2498
+ let e, t, n, i;
2499
  const s = [
2500
  { autoscroll: (
2501
  /*gradio*/
2502
+ l[9].autoscroll
2503
  ) },
2504
  { i18n: (
2505
  /*gradio*/
2506
+ l[9].i18n
2507
  ) },
2508
+ /*patched_loading_status*/
2509
+ l[10]
2510
  ];
2511
  let o = {};
2512
  for (let a = 0; a < s.length; a += 1)
2513
+ o = ql(o, s[a]);
2514
+ return e = new ml({ props: o }), e.$on(
2515
  "clear_status",
2516
  /*clear_status_handler*/
2517
+ l[15]
2518
  ), {
2519
  c() {
2520
+ zt(e.$$.fragment), t = Il(), n = Sl("div"), Cl(n, "class", "viewer svelte-mo2zro"), ct(
2521
+ n,
2522
  "height",
2523
  /*height*/
2524
+ l[0]
2525
  );
2526
  },
2527
  m(a, r) {
2528
+ Vt(e, a, r), Ee(a, t, r), Ee(a, n, r), l[16](n), i = !0;
2529
  },
2530
  p(a, r) {
2531
+ const f = r & /*gradio, patched_loading_status*/
2532
+ 1536 ? Vl(s, [
2533
  r & /*gradio*/
2534
  512 && { autoscroll: (
2535
  /*gradio*/
 
2540
  /*gradio*/
2541
  a[9].i18n
2542
  ) },
2543
+ r & /*patched_loading_status*/
2544
+ 1024 && Ml(
2545
+ /*patched_loading_status*/
2546
+ a[10]
2547
  )
2548
  ]) : {};
2549
  e.$set(f), r & /*height*/
2550
  1 && ct(
2551
+ n,
2552
  "height",
2553
  /*height*/
2554
  a[0]
 
2561
  ye(e.$$.fragment, a), i = !1;
2562
  },
2563
  d(a) {
2564
+ a && (Ne(t), Ne(n)), Mt(e, a), l[16](null);
2565
  }
2566
  };
2567
  }
2568
+ function Pl(l) {
2569
+ let e, t, n = !/*interactive*/
2570
+ l[8] && _t(l);
2571
  return {
2572
  c() {
2573
+ n && n.c(), e = zl();
2574
  },
2575
  m(i, s) {
2576
+ n && n.m(i, s), Ee(i, e, s), t = !0;
2577
  },
2578
  p(i, [s]) {
2579
  /*interactive*/
2580
+ i[8] ? n && (Nl(), ye(n, 1, 1, () => {
2581
+ n = null;
2582
+ }), Ll()) : n ? (n.p(i, s), s & /*interactive*/
2583
+ 256 && ae(n, 1)) : (n = _t(i), n.c(), ae(n, 1), n.m(e.parentNode, e));
2584
  },
2585
  i(i) {
2586
+ t || (ae(n), t = !0);
2587
  },
2588
  o(i) {
2589
+ ye(n), t = !1;
2590
  },
2591
  d(i) {
2592
+ i && Ne(e), n && n.d(i);
2593
  }
2594
  };
2595
  }
2596
+ function Wl(l, e, t) {
2597
+ let { elem_id: n = "" } = e, { elem_classes: i = [] } = e, { visible: s = !0 } = e, { height: o = 640 } = e, { value: a = null } = e, { container: r = !0 } = e, { scale: f = null } = e, { min_width: u = void 0 } = e, { loading_status: c } = e, { interactive: p } = e, { streaming: m } = e, y = null, { gradio: L } = e, v, F, d, _;
2598
+ function q() {
2599
+ if (JSON.stringify(a) !== JSON.stringify(y) && F != null && F.ready)
2600
+ if (y = a, !Array.isArray(a))
2601
+ a.is_stream ? F.open(a.url, { follow_if_http: !0 }) : F.open(a.url);
2602
+ else
2603
+ for (const g of a)
2604
+ typeof g != "string" ? g.url && F.open(g.url) : F.open(g);
2605
+ }
2606
+ jl(() => (F = new Ht(), F.start(void 0, d, !0).then(() => {
2607
+ q();
2608
+ }), () => {
2609
+ F.stop();
2610
+ }));
2611
+ const z = () => L.dispatch("clear_status", c);
2612
+ function b(g) {
2613
+ Fl[g ? "unshift" : "push"](() => {
2614
+ d = g, t(11, d);
2615
  });
2616
  }
2617
+ return l.$$set = (g) => {
2618
+ "elem_id" in g && t(1, n = g.elem_id), "elem_classes" in g && t(2, i = g.elem_classes), "visible" in g && t(3, s = g.visible), "height" in g && t(0, o = g.height), "value" in g && t(13, a = g.value), "container" in g && t(4, r = g.container), "scale" in g && t(5, f = g.scale), "min_width" in g && t(6, u = g.min_width), "loading_status" in g && t(7, c = g.loading_status), "interactive" in g && t(8, p = g.interactive), "streaming" in g && t(14, m = g.streaming), "gradio" in g && t(9, L = g.gradio);
2619
+ }, l.$$.update = () => {
2620
+ l.$$.dirty & /*height*/
2621
+ 1 && t(0, o = typeof o == "number" ? `${o}px` : o), l.$$.dirty & /*loading_status, streaming, patched_loading_status*/
2622
+ 17536 && (t(10, _ = c), m && _?.status === "generating" && t(10, _.status = "complete", _)), l.$$.dirty & /*value*/
2623
+ 8192 && q();
 
 
2624
  }, [
2625
  o,
2626
+ n,
2627
  i,
2628
  s,
2629
  r,
2630
  f,
2631
  u,
2632
+ c,
 
 
 
2633
  p,
 
 
2634
  L,
2635
+ _,
2636
+ d,
2637
+ v,
2638
+ a,
2639
+ m,
2640
+ z,
2641
+ b
2642
  ];
2643
  }
2644
+ class Dl extends vl {
2645
  constructor(e) {
2646
+ super(), El(this, e, Wl, Pl, Al, {
2647
  elem_id: 1,
2648
  elem_classes: 2,
2649
  visible: 3,
2650
  height: 0,
2651
+ value: 13,
2652
  container: 4,
2653
  scale: 5,
2654
  min_width: 6,
2655
  loading_status: 7,
2656
  interactive: 8,
2657
+ streaming: 14,
2658
  gradio: 9
2659
  });
2660
  }
 
2662
  return this.$$.ctx[1];
2663
  }
2664
  set elem_id(e) {
2665
+ this.$$set({ elem_id: e }), N();
2666
  }
2667
  get elem_classes() {
2668
  return this.$$.ctx[2];
2669
  }
2670
  set elem_classes(e) {
2671
+ this.$$set({ elem_classes: e }), N();
2672
  }
2673
  get visible() {
2674
  return this.$$.ctx[3];
2675
  }
2676
  set visible(e) {
2677
+ this.$$set({ visible: e }), N();
2678
  }
2679
  get height() {
2680
  return this.$$.ctx[0];
2681
  }
2682
  set height(e) {
2683
+ this.$$set({ height: e }), N();
2684
  }
2685
  get value() {
2686
+ return this.$$.ctx[13];
2687
  }
2688
  set value(e) {
2689
+ this.$$set({ value: e }), N();
2690
  }
2691
  get container() {
2692
  return this.$$.ctx[4];
2693
  }
2694
  set container(e) {
2695
+ this.$$set({ container: e }), N();
2696
  }
2697
  get scale() {
2698
  return this.$$.ctx[5];
2699
  }
2700
  set scale(e) {
2701
+ this.$$set({ scale: e }), N();
2702
  }
2703
  get min_width() {
2704
  return this.$$.ctx[6];
2705
  }
2706
  set min_width(e) {
2707
+ this.$$set({ min_width: e }), N();
2708
  }
2709
  get loading_status() {
2710
  return this.$$.ctx[7];
2711
  }
2712
  set loading_status(e) {
2713
+ this.$$set({ loading_status: e }), N();
2714
  }
2715
  get interactive() {
2716
  return this.$$.ctx[8];
2717
  }
2718
  set interactive(e) {
2719
+ this.$$set({ interactive: e }), N();
2720
+ }
2721
+ get streaming() {
2722
+ return this.$$.ctx[14];
2723
+ }
2724
+ set streaming(e) {
2725
+ this.$$set({ streaming: e }), N();
2726
  }
2727
  get gradio() {
2728
  return this.$$.ctx[9];
2729
  }
2730
  set gradio(e) {
2731
+ this.$$set({ gradio: e }), N();
2732
  }
2733
  }
2734
  export {
2735
+ Bl as BaseExample,
2736
+ Dl as default
2737
  };
src/backend/gradio_rerun/templates/component/re_viewer-DOCTrs8v.js ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:88c5313e5b992d2005e58716dc1e91d45ae0f33b6dfbf66301edd6bf9ea5cf80
3
+ size 29838314
src/backend/gradio_rerun/templates/component/style.css CHANGED
@@ -1 +1 @@
1
- /*! tailwindcss v4.0.0-alpha.14 | MIT License | https://tailwindcss.com */@layer theme{:root{--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4,0,.2,1);--default-font-family:var(--font-family-sans);--default-font-feature-settings:var(--font-family-sans--font-feature-settings);--default-font-variation-settings:var(--font-family-sans--font-variation-settings);--default-mono-font-family:var(--font-family-mono);--default-mono-font-feature-settings:var(--font-family-mono--font-feature-settings);--default-mono-font-variation-settings:var(--font-family-mono--font-variation-settings);--breakpoint-sm:640px;--breakpoint-md:768px;--breakpoint-lg:1024px;--breakpoint-xl:1280px;--breakpoint-2xl:1536px;--color-black:#000;--color-white:#fff;--color-slate-50:#f8fafc;--color-slate-100:#f1f5f9;--color-slate-200:#e2e8f0;--color-slate-300:#cbd5e1;--color-slate-400:#94a3b8;--color-slate-500:#64748b;--color-slate-600:#475569;--color-slate-700:#334155;--color-slate-800:#1e293b;--color-slate-900:#0f172a;--color-slate-950:#020617;--color-gray-50:#f9fafb;--color-gray-100:#f3f4f6;--color-gray-200:#e5e7eb;--color-gray-300:#d1d5db;--color-gray-400:#9ca3af;--color-gray-500:#6b7280;--color-gray-600:#4b5563;--color-gray-700:#374151;--color-gray-800:#1f2937;--color-gray-900:#111827;--color-gray-950:#030712;--color-zinc-50:#fafafa;--color-zinc-100:#f4f4f5;--color-zinc-200:#e4e4e7;--color-zinc-300:#d4d4d8;--color-zinc-400:#a1a1aa;--color-zinc-500:#71717a;--color-zinc-600:#52525b;--color-zinc-700:#3f3f46;--color-zinc-800:#27272a;--color-zinc-900:#18181b;--color-zinc-950:#09090b;--color-neutral-50:#fafafa;--color-neutral-100:#f5f5f5;--color-neutral-200:#e5e5e5;--color-neutral-300:#d4d4d4;--color-neutral-400:#a3a3a3;--color-neutral-500:#737373;--color-neutral-600:#525252;--color-neutral-700:#404040;--color-neutral-800:#262626;--color-neutral-900:#171717;--color-neutral-950:#0a0a0a;--color-stone-50:#fafaf9;--color-stone-100:#f5f5f4;--color-stone-200:#e7e5e4;--color-stone-300:#d6d3d1;--color-stone-400:#a8a29e;--color-stone-500:#78716c;--color-stone-600:#57534e;--color-stone-700:#44403c;--color-stone-800:#292524;--color-stone-900:#1c1917;--color-stone-950:#0c0a09;--color-red-50:#fef2f2;--color-red-100:#fee2e2;--color-red-200:#fecaca;--color-red-300:#fca5a5;--color-red-400:#f87171;--color-red-500:#ef4444;--color-red-600:#dc2626;--color-red-700:#b91c1c;--color-red-800:#991b1b;--color-red-900:#7f1d1d;--color-red-950:#450a0a;--color-orange-50:#fff7ed;--color-orange-100:#ffedd5;--color-orange-200:#fed7aa;--color-orange-300:#fdba74;--color-orange-400:#fb923c;--color-orange-500:#f97316;--color-orange-600:#ea580c;--color-orange-700:#c2410c;--color-orange-800:#9a3412;--color-orange-900:#7c2d12;--color-orange-950:#431407;--color-amber-50:#fffbeb;--color-amber-100:#fef3c7;--color-amber-200:#fde68a;--color-amber-300:#fcd34d;--color-amber-400:#fbbf24;--color-amber-500:#f59e0b;--color-amber-600:#d97706;--color-amber-700:#b45309;--color-amber-800:#92400e;--color-amber-900:#78350f;--color-amber-950:#451a03;--color-yellow-50:#fefce8;--color-yellow-100:#fef9c3;--color-yellow-200:#fef08a;--color-yellow-300:#fde047;--color-yellow-400:#facc15;--color-yellow-500:#eab308;--color-yellow-600:#ca8a04;--color-yellow-700:#a16207;--color-yellow-800:#854d0e;--color-yellow-900:#713f12;--color-yellow-950:#422006;--color-lime-50:#f7fee7;--color-lime-100:#ecfccb;--color-lime-200:#d9f99d;--color-lime-300:#bef264;--color-lime-400:#a3e635;--color-lime-500:#84cc16;--color-lime-600:#65a30d;--color-lime-700:#4d7c0f;--color-lime-800:#3f6212;--color-lime-900:#365314;--color-lime-950:#1a2e05;--color-green-50:#f0fdf4;--color-green-100:#dcfce7;--color-green-200:#bbf7d0;--color-green-300:#86efac;--color-green-400:#4ade80;--color-green-500:#22c55e;--color-green-600:#16a34a;--color-green-700:#15803d;--color-green-800:#166534;--color-green-900:#14532d;--color-green-950:#052e16;--color-emerald-50:#ecfdf5;--color-emerald-100:#d1fae5;--color-emerald-200:#a7f3d0;--color-emerald-300:#6ee7b7;--color-emerald-400:#34d399;--color-emerald-500:#10b981;--color-emerald-600:#059669;--color-emerald-700:#047857;--color-emerald-800:#065f46;--color-emerald-900:#064e3b;--color-emerald-950:#022c22;--color-teal-50:#f0fdfa;--color-teal-100:#ccfbf1;--color-teal-200:#99f6e4;--color-teal-300:#5eead4;--color-teal-400:#2dd4bf;--color-teal-500:#14b8a6;--color-teal-600:#0d9488;--color-teal-700:#0f766e;--color-teal-800:#115e59;--color-teal-900:#134e4a;--color-teal-950:#042f2e;--color-cyan-50:#ecfeff;--color-cyan-100:#cffafe;--color-cyan-200:#a5f3fc;--color-cyan-300:#67e8f9;--color-cyan-400:#22d3ee;--color-cyan-500:#06b6d4;--color-cyan-600:#0891b2;--color-cyan-700:#0e7490;--color-cyan-800:#155e75;--color-cyan-900:#164e63;--color-cyan-950:#083344;--color-sky-50:#f0f9ff;--color-sky-100:#e0f2fe;--color-sky-200:#bae6fd;--color-sky-300:#7dd3fc;--color-sky-400:#38bdf8;--color-sky-500:#0ea5e9;--color-sky-600:#0284c7;--color-sky-700:#0369a1;--color-sky-800:#075985;--color-sky-900:#0c4a6e;--color-sky-950:#082f49;--color-blue-50:#eff6ff;--color-blue-100:#dbeafe;--color-blue-200:#bfdbfe;--color-blue-300:#93c5fd;--color-blue-400:#60a5fa;--color-blue-500:#3b82f6;--color-blue-600:#2563eb;--color-blue-700:#1d4ed8;--color-blue-800:#1e40af;--color-blue-900:#1e3a8a;--color-blue-950:#172554;--color-indigo-50:#eef2ff;--color-indigo-100:#e0e7ff;--color-indigo-200:#c7d2fe;--color-indigo-300:#a5b4fc;--color-indigo-400:#818cf8;--color-indigo-500:#6366f1;--color-indigo-600:#4f46e5;--color-indigo-700:#4338ca;--color-indigo-800:#3730a3;--color-indigo-900:#312e81;--color-indigo-950:#1e1b4b;--color-violet-50:#f5f3ff;--color-violet-100:#ede9fe;--color-violet-200:#ddd6fe;--color-violet-300:#c4b5fd;--color-violet-400:#a78bfa;--color-violet-500:#8b5cf6;--color-violet-600:#7c3aed;--color-violet-700:#6d28d9;--color-violet-800:#5b21b6;--color-violet-900:#4c1d95;--color-violet-950:#2e1065;--color-purple-50:#faf5ff;--color-purple-100:#f3e8ff;--color-purple-200:#e9d5ff;--color-purple-300:#d8b4fe;--color-purple-400:#c084fc;--color-purple-500:#a855f7;--color-purple-600:#9333ea;--color-purple-700:#7e22ce;--color-purple-800:#6b21a8;--color-purple-900:#581c87;--color-purple-950:#3b0764;--color-fuchsia-50:#fdf4ff;--color-fuchsia-100:#fae8ff;--color-fuchsia-200:#f5d0fe;--color-fuchsia-300:#f0abfc;--color-fuchsia-400:#e879f9;--color-fuchsia-500:#d946ef;--color-fuchsia-600:#c026d3;--color-fuchsia-700:#a21caf;--color-fuchsia-800:#86198f;--color-fuchsia-900:#701a75;--color-fuchsia-950:#4a044e;--color-pink-50:#fdf2f8;--color-pink-100:#fce7f3;--color-pink-200:#fbcfe8;--color-pink-300:#f9a8d4;--color-pink-400:#f472b6;--color-pink-500:#ec4899;--color-pink-600:#db2777;--color-pink-700:#be185d;--color-pink-800:#9d174d;--color-pink-900:#831843;--color-pink-950:#500724;--color-rose-50:#fff1f2;--color-rose-100:#ffe4e6;--color-rose-200:#fecdd3;--color-rose-300:#fda4af;--color-rose-400:#fb7185;--color-rose-500:#f43f5e;--color-rose-600:#e11d48;--color-rose-700:#be123c;--color-rose-800:#9f1239;--color-rose-900:#881337;--color-rose-950:#4c0519;--animate-spin:spin 1s linear infinite;--animate-ping:ping 1s cubic-bezier(0,0,.2,1)infinite;--animate-pulse:pulse 2s cubic-bezier(.4,0,.6,1)infinite;--animate-bounce:bounce 1s infinite;--blur:8px;--blur-sm:4px;--blur-md:12px;--blur-lg:16px;--blur-xl:24px;--blur-2xl:40px;--blur-3xl:64px;--radius:.25rem;--radius-sm:.125rem;--radius-md:.375rem;--radius-lg:.5rem;--radius-xl:.75rem;--radius-2xl:1rem;--radius-3xl:1.5rem;--shadow:0 1px 3px 0 #0000001a,0 1px 2px -1px #0000001a;--shadow-xs:0 1px #0000000d;--shadow-sm:0 1px 2px 0 #0000000d;--shadow-md:0 4px 6px -1px #0000001a,0 2px 4px -2px #0000001a;--shadow-lg:0 10px 15px -3px #0000001a,0 4px 6px -4px #0000001a;--shadow-xl:0 20px 25px -5px #0000001a,0 8px 10px -6px #0000001a;--shadow-2xl:0 25px 50px -12px #00000040;--shadow-inner:inset 0 2px 4px 0 #0000000d;--inset-shadow-xs:inset 0 1px #0000000d;--inset-shadow-sm:inset 0 1px 1px #0000000d;--inset-shadow:inset 0 2px 4px #0000000d;--drop-shadow:0 1px 2px #0000001a,0 1px 1px #0000000f;--drop-shadow-sm:0 1px 1px #0000000d;--drop-shadow-md:0 4px 3px #00000012,0 2px 2px #0000000f;--drop-shadow-lg:0 10px 8px #0000000a,0 4px 3px #0000001a;--drop-shadow-xl:0 20px 13px #00000008,0 8px 5px #00000014;--drop-shadow-2xl:0 25px 25px #00000026;--spacing-px:1px;--spacing-0:0px;--spacing-0_5:.125rem;--spacing-1:.25rem;--spacing-1_5:.375rem;--spacing-2:.5rem;--spacing-2_5:.625rem;--spacing-3:.75rem;--spacing-3_5:.875rem;--spacing-4:1rem;--spacing-5:1.25rem;--spacing-6:1.5rem;--spacing-7:1.75rem;--spacing-8:2rem;--spacing-9:2.25rem;--spacing-10:2.5rem;--spacing-11:2.75rem;--spacing-12:3rem;--spacing-14:3.5rem;--spacing-16:4rem;--spacing-20:5rem;--spacing-24:6rem;--spacing-28:7rem;--spacing-32:8rem;--spacing-36:9rem;--spacing-40:10rem;--spacing-44:11rem;--spacing-48:12rem;--spacing-52:13rem;--spacing-56:14rem;--spacing-60:15rem;--spacing-64:16rem;--spacing-72:18rem;--spacing-80:20rem;--spacing-96:24rem;--width-3xs:16rem;--width-2xs:18rem;--width-xs:20rem;--width-sm:24rem;--width-md:28rem;--width-lg:32rem;--width-xl:36rem;--width-2xl:42rem;--width-3xl:48rem;--width-4xl:56rem;--width-5xl:64rem;--width-6xl:72rem;--width-7xl:80rem;--width-prose:65ch;--font-family-sans:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";--font-family-serif:ui-serif,Georgia,Cambria,"Times New Roman",Times,serif;--font-family-mono:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;--font-size-xs:.75rem;--font-size-xs--line-height:1rem;--font-size-sm:.875rem;--font-size-sm--line-height:1.25rem;--font-size-base:1rem;--font-size-base--line-height:1.5rem;--font-size-lg:1.125rem;--font-size-lg--line-height:1.75rem;--font-size-xl:1.25rem;--font-size-xl--line-height:1.75rem;--font-size-2xl:1.5rem;--font-size-2xl--line-height:2rem;--font-size-3xl:1.875rem;--font-size-3xl--line-height:2.25rem;--font-size-4xl:2.25rem;--font-size-4xl--line-height:2.5rem;--font-size-5xl:3rem;--font-size-5xl--line-height:1;--font-size-6xl:3.75rem;--font-size-6xl--line-height:1;--font-size-7xl:4.5rem;--font-size-7xl--line-height:1;--font-size-8xl:6rem;--font-size-8xl--line-height:1;--font-size-9xl:8rem;--font-size-9xl--line-height:1;--letter-spacing-tighter:-.05em;--letter-spacing-tight:-.025em;--letter-spacing-normal:0em;--letter-spacing-wide:.025em;--letter-spacing-wider:.05em;--letter-spacing-widest:.1em;--line-height-none:1;--line-height-tight:1.25;--line-height-snug:1.375;--line-height-normal:1.5;--line-height-relaxed:1.625;--line-height-loose:2;--line-height-3:.75rem;--line-height-4:1rem;--line-height-5:1.25rem;--line-height-6:1.5rem;--line-height-7:1.75rem;--line-height-8:2rem;--line-height-9:2.25rem;--line-height-10:2.5rem;--perspective-dramatic:100px;--perspective-near:300px;--perspective-normal:500px;--perspective-midrange:800px;--perspective-distant:1200px;--transition-timing-function-linear:linear;--transition-timing-function-in:cubic-bezier(.4,0,1,1);--transition-timing-function-out:cubic-bezier(0,0,.2,1);--transition-timing-function-in-out:cubic-bezier(.4,0,.2,1)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}body{line-height:inherit}hr{color:inherit;border-top-width:1px;height:0}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;background:0 0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;background:0 0}input:where(:not([type=button],[type=reset],[type=submit])),select,textarea{border:1px solid}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}::-webkit-search-decoration{-webkit-appearance:none}summary{display:list-item}ol,ul,menu{list-style:none}textarea{resize:vertical}::placeholder{opacity:1;color:color-mix(in srgb,currentColor 50%,transparent)}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}[hidden]{display:none!important}}@layer components;@layer utilities{.invisible{visibility:hidden}.visible{visibility:visible}.sr-only{clip:rect(0,0,0,0);white-space:nowrap;border-width:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}.absolute{position:absolute}.static,.static\/Loader,.static\/Toast,.static\/index,.static\/types{position:static}.block{display:block}.hidden{display:none}.table{display:table}.transform{transform:var(--tw-rotate-x)var(--tw-rotate-y)var(--tw-rotate-z)var(--tw-skew-x)var(--tw-skew-y)}.border{border-style:var(--tw-border-style);border-width:1px}.blur{--tw-blur:blur(8px);filter:var(--tw-blur,)var(--tw-brightness,)var(--tw-contrast,)var(--tw-grayscale,)var(--tw-hue-rotate,)var(--tw-invert,)var(--tw-saturate,)var(--tw-sepia,)var(--tw-drop-shadow,)}.filter{filter:var(--tw-blur,)var(--tw-brightness,)var(--tw-contrast,)var(--tw-grayscale,)var(--tw-hue-rotate,)var(--tw-invert,)var(--tw-saturate,)var(--tw-sepia,)var(--tw-drop-shadow,)}.transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,-webkit-backdrop-filter,backdrop-filter;transition-duration:.15s;transition-timing-function:cubic-bezier(.4,0,.2,1)}.ease-in-out{transition-timing-function:var(--transition-timing-function-in-out,cubic-bezier(.4,0,.2,1))}}@keyframes spin{to{transform:rotate(360deg)}}@keyframes ping{75%,to{opacity:0;transform:scale(2)}}@keyframes pulse{50%{opacity:.5}}@keyframes bounce{0%,to{animation-timing-function:cubic-bezier(.8,0,1,1);transform:translateY(-25%)}50%{animation-timing-function:cubic-bezier(0,0,.2,1);transform:none}}@property --tw-rotate-x{syntax:"<transform-function>";inherits:false;initial-value:rotateX(0)}@property --tw-rotate-y{syntax:"<transform-function>";inherits:false;initial-value:rotateY(0)}@property --tw-rotate-z{syntax:"<transform-function>";inherits:false;initial-value:rotate(0)}@property --tw-skew-x{syntax:"<transform-function>";inherits:false;initial-value:skew(0)}@property --tw-skew-y{syntax:"<transform-function>";inherits:false;initial-value:skewY(0)}@property --tw-border-style{syntax:"<custom-ident>";inherits:false;initial-value:solid}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}.block.svelte-nl1om8{position:relative;margin:0;box-shadow:var(--block-shadow);border-width:var(--block-border-width);border-color:var(--block-border-color);border-radius:var(--block-radius);background:var(--block-background-fill);width:100%;line-height:var(--line-sm)}.block.border_focus.svelte-nl1om8{border-color:var(--color-accent)}.block.border_contrast.svelte-nl1om8{border-color:var(--body-text-color)}.padded.svelte-nl1om8{padding:var(--block-padding)}.hidden.svelte-nl1om8{display:none}.hide-container.svelte-nl1om8{margin:0;box-shadow:none;--block-border-width:0;background:transparent;padding:0;overflow:visible}div.svelte-1hnfib2{margin-bottom:var(--spacing-lg);color:var(--block-info-text-color);font-weight:var(--block-info-text-weight);font-size:var(--block-info-text-size);line-height:var(--line-sm)}span.has-info.svelte-22c38v{margin-bottom:var(--spacing-xs)}span.svelte-22c38v:not(.has-info){margin-bottom:var(--spacing-lg)}span.svelte-22c38v{display:inline-block;position:relative;z-index:var(--layer-4);border:solid var(--block-title-border-width) var(--block-title-border-color);border-radius:var(--block-title-radius);background:var(--block-title-background-fill);padding:var(--block-title-padding);color:var(--block-title-text-color);font-weight:var(--block-title-text-weight);font-size:var(--block-title-text-size);line-height:var(--line-sm)}.hide.svelte-22c38v{margin:0;height:0}label.svelte-9gxdi0{display:inline-flex;align-items:center;z-index:var(--layer-2);box-shadow:var(--block-label-shadow);border:var(--block-label-border-width) solid var(--border-color-primary);border-top:none;border-left:none;border-radius:var(--block-label-radius);background:var(--block-label-background-fill);padding:var(--block-label-padding);pointer-events:none;color:var(--block-label-text-color);font-weight:var(--block-label-text-weight);font-size:var(--block-label-text-size);line-height:var(--line-sm)}.gr-group label.svelte-9gxdi0{border-top-left-radius:0}label.float.svelte-9gxdi0{position:absolute;top:var(--block-label-margin);left:var(--block-label-margin)}label.svelte-9gxdi0:not(.float){position:static;margin-top:var(--block-label-margin);margin-left:var(--block-label-margin)}.hide.svelte-9gxdi0{height:0}span.svelte-9gxdi0{opacity:.8;margin-right:var(--size-2);width:calc(var(--block-label-text-size) - 1px);height:calc(var(--block-label-text-size) - 1px)}.hide-label.svelte-9gxdi0{box-shadow:none;border-width:0;background:transparent;overflow:visible}button.svelte-1lrphxw{display:flex;justify-content:center;align-items:center;gap:1px;z-index:var(--layer-2);border-radius:var(--radius-sm);color:var(--block-label-text-color);border:1px solid transparent}button[disabled].svelte-1lrphxw{opacity:.5;box-shadow:none}button[disabled].svelte-1lrphxw:hover{cursor:not-allowed}.padded.svelte-1lrphxw{padding:2px;background:var(--bg-color);box-shadow:var(--shadow-drop);border:1px solid var(--button-secondary-border-color)}button.svelte-1lrphxw:hover,button.highlight.svelte-1lrphxw{cursor:pointer;color:var(--color-accent)}.padded.svelte-1lrphxw:hover{border:2px solid var(--button-secondary-border-color-hover);padding:1px;color:var(--block-label-text-color)}span.svelte-1lrphxw{padding:0 1px;font-size:10px}div.svelte-1lrphxw{padding:2px;display:flex;align-items:flex-end}.small.svelte-1lrphxw{width:14px;height:14px}.medium.svelte-1lrphxw{width:20px;height:20px}.large.svelte-1lrphxw{width:22px;height:22px}.pending.svelte-1lrphxw{animation:svelte-1lrphxw-flash .5s infinite}@keyframes svelte-1lrphxw-flash{0%{opacity:.5}50%{opacity:1}to{opacity:.5}}.transparent.svelte-1lrphxw{background:transparent;border:none;box-shadow:none}.empty.svelte-3w3rth{display:flex;justify-content:center;align-items:center;margin-top:calc(0px - var(--size-6));height:var(--size-full)}.icon.svelte-3w3rth{opacity:.5;height:var(--size-5);color:var(--body-text-color)}.small.svelte-3w3rth{min-height:calc(var(--size-32) - 20px)}.large.svelte-3w3rth{min-height:calc(var(--size-64) - 20px)}.unpadded_box.svelte-3w3rth{margin-top:0}.small_parent.svelte-3w3rth{min-height:100%!important}.dropdown-arrow.svelte-145leq6{fill:currentColor}.wrap.svelte-kzcjhc{display:flex;flex-direction:column;justify-content:center;align-items:center;min-height:var(--size-60);color:var(--block-label-text-color);line-height:var(--line-md);height:100%;padding-top:var(--size-3)}.or.svelte-kzcjhc{color:var(--body-text-color-subdued);display:flex}.icon-wrap.svelte-kzcjhc{width:30px;margin-bottom:var(--spacing-lg)}@media (--screen-md){.wrap.svelte-kzcjhc{font-size:var(--text-lg)}}.hovered.svelte-kzcjhc{color:var(--color-accent)}div.svelte-q32hvf{border-top:1px solid transparent;display:flex;max-height:100%;justify-content:center;align-items:center;gap:var(--spacing-sm);height:auto;align-items:flex-end;color:var(--block-label-text-color);flex-shrink:0}.show_border.svelte-q32hvf{border-top:1px solid var(--block-border-color);margin-top:var(--spacing-xxl);box-shadow:var(--shadow-drop)}.source-selection.svelte-1jp3vgd{display:flex;align-items:center;justify-content:center;border-top:1px solid var(--border-color-primary);width:95%;bottom:0;left:0;right:0;margin-left:auto;margin-right:auto}.icon.svelte-1jp3vgd{width:22px;height:22px;margin:var(--spacing-lg) var(--spacing-xs);padding:var(--spacing-xs);color:var(--neutral-400);border-radius:var(--radius-md)}.selected.svelte-1jp3vgd{color:var(--color-accent)}.icon.svelte-1jp3vgd:hover,.icon.svelte-1jp3vgd:focus{color:var(--color-accent)}svg.svelte-43sxxs.svelte-43sxxs{width:var(--size-20);height:var(--size-20)}svg.svelte-43sxxs path.svelte-43sxxs{fill:var(--loader-color)}div.svelte-43sxxs.svelte-43sxxs{z-index:var(--layer-2)}.margin.svelte-43sxxs.svelte-43sxxs{margin:var(--size-4)}.wrap.svelte-1yk38uw.svelte-1yk38uw{display:flex;flex-direction:column;justify-content:center;align-items:center;z-index:var(--layer-top);transition:opacity .1s ease-in-out;border-radius:var(--block-radius);background:var(--block-background-fill);padding:0 var(--size-6);max-height:var(--size-screen-h);overflow:hidden}.wrap.center.svelte-1yk38uw.svelte-1yk38uw{top:0;right:0;left:0}.wrap.default.svelte-1yk38uw.svelte-1yk38uw{inset:0}.hide.svelte-1yk38uw.svelte-1yk38uw{opacity:0;pointer-events:none}.generating.svelte-1yk38uw.svelte-1yk38uw{animation:svelte-1yk38uw-pulse 2s cubic-bezier(.4,0,.6,1) infinite;border:2px solid var(--color-accent);background:transparent;z-index:var(--layer-1)}.translucent.svelte-1yk38uw.svelte-1yk38uw{background:none}@keyframes svelte-1yk38uw-pulse{0%,to{opacity:1}50%{opacity:.5}}.loading.svelte-1yk38uw.svelte-1yk38uw{z-index:var(--layer-2);color:var(--body-text-color)}.eta-bar.svelte-1yk38uw.svelte-1yk38uw{position:absolute;inset:0;transform-origin:left;opacity:.8;z-index:var(--layer-1);transition:10ms;background:var(--background-fill-secondary)}.progress-bar-wrap.svelte-1yk38uw.svelte-1yk38uw{border:1px solid var(--border-color-primary);background:var(--background-fill-primary);width:55.5%;height:var(--size-4)}.progress-bar.svelte-1yk38uw.svelte-1yk38uw{transform-origin:left;background-color:var(--loader-color);width:var(--size-full);height:var(--size-full)}.progress-level.svelte-1yk38uw.svelte-1yk38uw{display:flex;flex-direction:column;align-items:center;gap:1;z-index:var(--layer-2);width:var(--size-full)}.progress-level-inner.svelte-1yk38uw.svelte-1yk38uw{margin:var(--size-2) auto;color:var(--body-text-color);font-size:var(--text-sm);font-family:var(--font-mono)}.meta-text.svelte-1yk38uw.svelte-1yk38uw{position:absolute;top:0;right:0;z-index:var(--layer-2);padding:var(--size-1) var(--size-2);font-size:var(--text-sm);font-family:var(--font-mono)}.meta-text-center.svelte-1yk38uw.svelte-1yk38uw{display:flex;position:absolute;top:0;right:0;justify-content:center;align-items:center;transform:translateY(var(--size-6));z-index:var(--layer-2);padding:var(--size-1) var(--size-2);font-size:var(--text-sm);font-family:var(--font-mono);text-align:center}.error.svelte-1yk38uw.svelte-1yk38uw{box-shadow:var(--shadow-drop);border:solid 1px var(--error-border-color);border-radius:var(--radius-full);background:var(--error-background-fill);padding-right:var(--size-4);padding-left:var(--size-4);color:var(--error-text-color);font-weight:var(--weight-semibold);font-size:var(--text-lg);line-height:var(--line-lg);font-family:var(--font)}.minimal.svelte-1yk38uw .progress-text.svelte-1yk38uw{background:var(--block-background-fill)}.border.svelte-1yk38uw.svelte-1yk38uw{border:1px solid var(--border-color-primary)}.clear-status.svelte-1yk38uw.svelte-1yk38uw{position:absolute;display:flex;top:var(--size-2);right:var(--size-2);justify-content:flex-end;gap:var(--spacing-sm);z-index:var(--layer-1)}.toast-body.svelte-solcu7{display:flex;position:relative;right:0;left:0;align-items:center;margin:var(--size-6) var(--size-4);margin:auto;border-radius:var(--container-radius);overflow:hidden;pointer-events:auto}.toast-body.error.svelte-solcu7{border:1px solid var(--color-red-700);background:var(--color-red-50)}.dark .toast-body.error.svelte-solcu7{border:1px solid var(--color-red-500);background-color:var(--color-grey-950)}.toast-body.warning.svelte-solcu7{border:1px solid var(--color-yellow-700);background:var(--color-yellow-50)}.dark .toast-body.warning.svelte-solcu7{border:1px solid var(--color-yellow-500);background-color:var(--color-grey-950)}.toast-body.info.svelte-solcu7{border:1px solid var(--color-grey-700);background:var(--color-grey-50)}.dark .toast-body.info.svelte-solcu7{border:1px solid var(--color-grey-500);background-color:var(--color-grey-950)}.toast-title.svelte-solcu7{display:flex;align-items:center;font-weight:var(--weight-bold);font-size:var(--text-lg);line-height:var(--line-sm);text-transform:capitalize}.toast-title.error.svelte-solcu7{color:var(--color-red-700)}.dark .toast-title.error.svelte-solcu7{color:var(--color-red-50)}.toast-title.warning.svelte-solcu7{color:var(--color-yellow-700)}.dark .toast-title.warning.svelte-solcu7{color:var(--color-yellow-50)}.toast-title.info.svelte-solcu7{color:var(--color-grey-700)}.dark .toast-title.info.svelte-solcu7{color:var(--color-grey-50)}.toast-close.svelte-solcu7{margin:0 var(--size-3);border-radius:var(--size-3);padding:0px var(--size-1-5);font-size:var(--size-5);line-height:var(--size-5)}.toast-close.error.svelte-solcu7{color:var(--color-red-700)}.dark .toast-close.error.svelte-solcu7{color:var(--color-red-500)}.toast-close.warning.svelte-solcu7{color:var(--color-yellow-700)}.dark .toast-close.warning.svelte-solcu7{color:var(--color-yellow-500)}.toast-close.info.svelte-solcu7{color:var(--color-grey-700)}.dark .toast-close.info.svelte-solcu7{color:var(--color-grey-500)}.toast-text.svelte-solcu7{font-size:var(--text-lg)}.toast-text.error.svelte-solcu7{color:var(--color-red-700)}.dark .toast-text.error.svelte-solcu7{color:var(--color-red-50)}.toast-text.warning.svelte-solcu7{color:var(--color-yellow-700)}.dark .toast-text.warning.svelte-solcu7{color:var(--color-yellow-50)}.toast-text.info.svelte-solcu7{color:var(--color-grey-700)}.dark .toast-text.info.svelte-solcu7{color:var(--color-grey-50)}.toast-details.svelte-solcu7{margin:var(--size-3) var(--size-3) var(--size-3) 0;width:100%}.toast-icon.svelte-solcu7{display:flex;position:absolute;position:relative;flex-shrink:0;justify-content:center;align-items:center;margin:var(--size-2);border-radius:var(--radius-full);padding:var(--size-1);padding-left:calc(var(--size-1) - 1px);width:35px;height:35px}.toast-icon.error.svelte-solcu7{color:var(--color-red-700)}.dark .toast-icon.error.svelte-solcu7{color:var(--color-red-500)}.toast-icon.warning.svelte-solcu7{color:var(--color-yellow-700)}.dark .toast-icon.warning.svelte-solcu7{color:var(--color-yellow-500)}.toast-icon.info.svelte-solcu7{color:var(--color-grey-700)}.dark .toast-icon.info.svelte-solcu7{color:var(--color-grey-500)}@keyframes svelte-solcu7-countdown{0%{transform:scaleX(1)}to{transform:scaleX(0)}}.timer.svelte-solcu7{position:absolute;bottom:0;left:0;transform-origin:0 0;animation:svelte-solcu7-countdown 10s linear forwards;width:100%;height:var(--size-1)}.timer.error.svelte-solcu7{background:var(--color-red-700)}.dark .timer.error.svelte-solcu7{background:var(--color-red-500)}.timer.warning.svelte-solcu7{background:var(--color-yellow-700)}.dark .timer.warning.svelte-solcu7{background:var(--color-yellow-500)}.timer.info.svelte-solcu7{background:var(--color-grey-700)}.dark .timer.info.svelte-solcu7{background:var(--color-grey-500)}.toast-wrap.svelte-gatr8h{display:flex;position:fixed;top:var(--size-4);right:var(--size-4);flex-direction:column;align-items:end;gap:var(--size-2);z-index:var(--layer-top);width:calc(100% - var(--size-8))}@media (--screen-sm){.toast-wrap.svelte-gatr8h{width:calc(var(--size-96) + var(--size-10))}}.container.svelte-giydt1 img{width:100%;height:100%}.container.selected.svelte-giydt1.svelte-giydt1{border-color:var(--border-color-accent)}.container.table.svelte-giydt1.svelte-giydt1{margin:0 auto;border:2px solid var(--border-color-primary);border-radius:var(--radius-lg);overflow:hidden;width:var(--size-20);height:var(--size-20);object-fit:cover}.container.gallery.svelte-giydt1.svelte-giydt1{height:var(--size-20);max-height:var(--size-20);object-fit:cover}.container.svelte-giydt1 img.svelte-giydt1{object-fit:cover}.viewer.svelte-gu2pck{width:100%}div.viewer>canvas{position:initial!important;top:unset!important}
 
1
+ /*! tailwindcss v4.0.0-alpha.14 | MIT License | https://tailwindcss.com */@layer theme{:root{--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4,0,.2,1);--default-font-family:var(--font-family-sans);--default-font-feature-settings:var(--font-family-sans--font-feature-settings);--default-font-variation-settings:var(--font-family-sans--font-variation-settings);--default-mono-font-family:var(--font-family-mono);--default-mono-font-feature-settings:var(--font-family-mono--font-feature-settings);--default-mono-font-variation-settings:var(--font-family-mono--font-variation-settings);--breakpoint-sm:640px;--breakpoint-md:768px;--breakpoint-lg:1024px;--breakpoint-xl:1280px;--breakpoint-2xl:1536px;--color-black:#000;--color-white:#fff;--color-slate-50:#f8fafc;--color-slate-100:#f1f5f9;--color-slate-200:#e2e8f0;--color-slate-300:#cbd5e1;--color-slate-400:#94a3b8;--color-slate-500:#64748b;--color-slate-600:#475569;--color-slate-700:#334155;--color-slate-800:#1e293b;--color-slate-900:#0f172a;--color-slate-950:#020617;--color-gray-50:#f9fafb;--color-gray-100:#f3f4f6;--color-gray-200:#e5e7eb;--color-gray-300:#d1d5db;--color-gray-400:#9ca3af;--color-gray-500:#6b7280;--color-gray-600:#4b5563;--color-gray-700:#374151;--color-gray-800:#1f2937;--color-gray-900:#111827;--color-gray-950:#030712;--color-zinc-50:#fafafa;--color-zinc-100:#f4f4f5;--color-zinc-200:#e4e4e7;--color-zinc-300:#d4d4d8;--color-zinc-400:#a1a1aa;--color-zinc-500:#71717a;--color-zinc-600:#52525b;--color-zinc-700:#3f3f46;--color-zinc-800:#27272a;--color-zinc-900:#18181b;--color-zinc-950:#09090b;--color-neutral-50:#fafafa;--color-neutral-100:#f5f5f5;--color-neutral-200:#e5e5e5;--color-neutral-300:#d4d4d4;--color-neutral-400:#a3a3a3;--color-neutral-500:#737373;--color-neutral-600:#525252;--color-neutral-700:#404040;--color-neutral-800:#262626;--color-neutral-900:#171717;--color-neutral-950:#0a0a0a;--color-stone-50:#fafaf9;--color-stone-100:#f5f5f4;--color-stone-200:#e7e5e4;--color-stone-300:#d6d3d1;--color-stone-400:#a8a29e;--color-stone-500:#78716c;--color-stone-600:#57534e;--color-stone-700:#44403c;--color-stone-800:#292524;--color-stone-900:#1c1917;--color-stone-950:#0c0a09;--color-red-50:#fef2f2;--color-red-100:#fee2e2;--color-red-200:#fecaca;--color-red-300:#fca5a5;--color-red-400:#f87171;--color-red-500:#ef4444;--color-red-600:#dc2626;--color-red-700:#b91c1c;--color-red-800:#991b1b;--color-red-900:#7f1d1d;--color-red-950:#450a0a;--color-orange-50:#fff7ed;--color-orange-100:#ffedd5;--color-orange-200:#fed7aa;--color-orange-300:#fdba74;--color-orange-400:#fb923c;--color-orange-500:#f97316;--color-orange-600:#ea580c;--color-orange-700:#c2410c;--color-orange-800:#9a3412;--color-orange-900:#7c2d12;--color-orange-950:#431407;--color-amber-50:#fffbeb;--color-amber-100:#fef3c7;--color-amber-200:#fde68a;--color-amber-300:#fcd34d;--color-amber-400:#fbbf24;--color-amber-500:#f59e0b;--color-amber-600:#d97706;--color-amber-700:#b45309;--color-amber-800:#92400e;--color-amber-900:#78350f;--color-amber-950:#451a03;--color-yellow-50:#fefce8;--color-yellow-100:#fef9c3;--color-yellow-200:#fef08a;--color-yellow-300:#fde047;--color-yellow-400:#facc15;--color-yellow-500:#eab308;--color-yellow-600:#ca8a04;--color-yellow-700:#a16207;--color-yellow-800:#854d0e;--color-yellow-900:#713f12;--color-yellow-950:#422006;--color-lime-50:#f7fee7;--color-lime-100:#ecfccb;--color-lime-200:#d9f99d;--color-lime-300:#bef264;--color-lime-400:#a3e635;--color-lime-500:#84cc16;--color-lime-600:#65a30d;--color-lime-700:#4d7c0f;--color-lime-800:#3f6212;--color-lime-900:#365314;--color-lime-950:#1a2e05;--color-green-50:#f0fdf4;--color-green-100:#dcfce7;--color-green-200:#bbf7d0;--color-green-300:#86efac;--color-green-400:#4ade80;--color-green-500:#22c55e;--color-green-600:#16a34a;--color-green-700:#15803d;--color-green-800:#166534;--color-green-900:#14532d;--color-green-950:#052e16;--color-emerald-50:#ecfdf5;--color-emerald-100:#d1fae5;--color-emerald-200:#a7f3d0;--color-emerald-300:#6ee7b7;--color-emerald-400:#34d399;--color-emerald-500:#10b981;--color-emerald-600:#059669;--color-emerald-700:#047857;--color-emerald-800:#065f46;--color-emerald-900:#064e3b;--color-emerald-950:#022c22;--color-teal-50:#f0fdfa;--color-teal-100:#ccfbf1;--color-teal-200:#99f6e4;--color-teal-300:#5eead4;--color-teal-400:#2dd4bf;--color-teal-500:#14b8a6;--color-teal-600:#0d9488;--color-teal-700:#0f766e;--color-teal-800:#115e59;--color-teal-900:#134e4a;--color-teal-950:#042f2e;--color-cyan-50:#ecfeff;--color-cyan-100:#cffafe;--color-cyan-200:#a5f3fc;--color-cyan-300:#67e8f9;--color-cyan-400:#22d3ee;--color-cyan-500:#06b6d4;--color-cyan-600:#0891b2;--color-cyan-700:#0e7490;--color-cyan-800:#155e75;--color-cyan-900:#164e63;--color-cyan-950:#083344;--color-sky-50:#f0f9ff;--color-sky-100:#e0f2fe;--color-sky-200:#bae6fd;--color-sky-300:#7dd3fc;--color-sky-400:#38bdf8;--color-sky-500:#0ea5e9;--color-sky-600:#0284c7;--color-sky-700:#0369a1;--color-sky-800:#075985;--color-sky-900:#0c4a6e;--color-sky-950:#082f49;--color-blue-50:#eff6ff;--color-blue-100:#dbeafe;--color-blue-200:#bfdbfe;--color-blue-300:#93c5fd;--color-blue-400:#60a5fa;--color-blue-500:#3b82f6;--color-blue-600:#2563eb;--color-blue-700:#1d4ed8;--color-blue-800:#1e40af;--color-blue-900:#1e3a8a;--color-blue-950:#172554;--color-indigo-50:#eef2ff;--color-indigo-100:#e0e7ff;--color-indigo-200:#c7d2fe;--color-indigo-300:#a5b4fc;--color-indigo-400:#818cf8;--color-indigo-500:#6366f1;--color-indigo-600:#4f46e5;--color-indigo-700:#4338ca;--color-indigo-800:#3730a3;--color-indigo-900:#312e81;--color-indigo-950:#1e1b4b;--color-violet-50:#f5f3ff;--color-violet-100:#ede9fe;--color-violet-200:#ddd6fe;--color-violet-300:#c4b5fd;--color-violet-400:#a78bfa;--color-violet-500:#8b5cf6;--color-violet-600:#7c3aed;--color-violet-700:#6d28d9;--color-violet-800:#5b21b6;--color-violet-900:#4c1d95;--color-violet-950:#2e1065;--color-purple-50:#faf5ff;--color-purple-100:#f3e8ff;--color-purple-200:#e9d5ff;--color-purple-300:#d8b4fe;--color-purple-400:#c084fc;--color-purple-500:#a855f7;--color-purple-600:#9333ea;--color-purple-700:#7e22ce;--color-purple-800:#6b21a8;--color-purple-900:#581c87;--color-purple-950:#3b0764;--color-fuchsia-50:#fdf4ff;--color-fuchsia-100:#fae8ff;--color-fuchsia-200:#f5d0fe;--color-fuchsia-300:#f0abfc;--color-fuchsia-400:#e879f9;--color-fuchsia-500:#d946ef;--color-fuchsia-600:#c026d3;--color-fuchsia-700:#a21caf;--color-fuchsia-800:#86198f;--color-fuchsia-900:#701a75;--color-fuchsia-950:#4a044e;--color-pink-50:#fdf2f8;--color-pink-100:#fce7f3;--color-pink-200:#fbcfe8;--color-pink-300:#f9a8d4;--color-pink-400:#f472b6;--color-pink-500:#ec4899;--color-pink-600:#db2777;--color-pink-700:#be185d;--color-pink-800:#9d174d;--color-pink-900:#831843;--color-pink-950:#500724;--color-rose-50:#fff1f2;--color-rose-100:#ffe4e6;--color-rose-200:#fecdd3;--color-rose-300:#fda4af;--color-rose-400:#fb7185;--color-rose-500:#f43f5e;--color-rose-600:#e11d48;--color-rose-700:#be123c;--color-rose-800:#9f1239;--color-rose-900:#881337;--color-rose-950:#4c0519;--animate-spin:spin 1s linear infinite;--animate-ping:ping 1s cubic-bezier(0,0,.2,1)infinite;--animate-pulse:pulse 2s cubic-bezier(.4,0,.6,1)infinite;--animate-bounce:bounce 1s infinite;--blur:8px;--blur-sm:4px;--blur-md:12px;--blur-lg:16px;--blur-xl:24px;--blur-2xl:40px;--blur-3xl:64px;--radius:.25rem;--radius-sm:.125rem;--radius-md:.375rem;--radius-lg:.5rem;--radius-xl:.75rem;--radius-2xl:1rem;--radius-3xl:1.5rem;--shadow:0 1px 3px 0 #0000001a,0 1px 2px -1px #0000001a;--shadow-xs:0 1px #0000000d;--shadow-sm:0 1px 2px 0 #0000000d;--shadow-md:0 4px 6px -1px #0000001a,0 2px 4px -2px #0000001a;--shadow-lg:0 10px 15px -3px #0000001a,0 4px 6px -4px #0000001a;--shadow-xl:0 20px 25px -5px #0000001a,0 8px 10px -6px #0000001a;--shadow-2xl:0 25px 50px -12px #00000040;--shadow-inner:inset 0 2px 4px 0 #0000000d;--inset-shadow-xs:inset 0 1px #0000000d;--inset-shadow-sm:inset 0 1px 1px #0000000d;--inset-shadow:inset 0 2px 4px #0000000d;--drop-shadow:0 1px 2px #0000001a,0 1px 1px #0000000f;--drop-shadow-sm:0 1px 1px #0000000d;--drop-shadow-md:0 4px 3px #00000012,0 2px 2px #0000000f;--drop-shadow-lg:0 10px 8px #0000000a,0 4px 3px #0000001a;--drop-shadow-xl:0 20px 13px #00000008,0 8px 5px #00000014;--drop-shadow-2xl:0 25px 25px #00000026;--spacing-px:1px;--spacing-0:0px;--spacing-0_5:.125rem;--spacing-1:.25rem;--spacing-1_5:.375rem;--spacing-2:.5rem;--spacing-2_5:.625rem;--spacing-3:.75rem;--spacing-3_5:.875rem;--spacing-4:1rem;--spacing-5:1.25rem;--spacing-6:1.5rem;--spacing-7:1.75rem;--spacing-8:2rem;--spacing-9:2.25rem;--spacing-10:2.5rem;--spacing-11:2.75rem;--spacing-12:3rem;--spacing-14:3.5rem;--spacing-16:4rem;--spacing-20:5rem;--spacing-24:6rem;--spacing-28:7rem;--spacing-32:8rem;--spacing-36:9rem;--spacing-40:10rem;--spacing-44:11rem;--spacing-48:12rem;--spacing-52:13rem;--spacing-56:14rem;--spacing-60:15rem;--spacing-64:16rem;--spacing-72:18rem;--spacing-80:20rem;--spacing-96:24rem;--width-3xs:16rem;--width-2xs:18rem;--width-xs:20rem;--width-sm:24rem;--width-md:28rem;--width-lg:32rem;--width-xl:36rem;--width-2xl:42rem;--width-3xl:48rem;--width-4xl:56rem;--width-5xl:64rem;--width-6xl:72rem;--width-7xl:80rem;--width-prose:65ch;--font-family-sans:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";--font-family-serif:ui-serif,Georgia,Cambria,"Times New Roman",Times,serif;--font-family-mono:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;--font-size-xs:.75rem;--font-size-xs--line-height:1rem;--font-size-sm:.875rem;--font-size-sm--line-height:1.25rem;--font-size-base:1rem;--font-size-base--line-height:1.5rem;--font-size-lg:1.125rem;--font-size-lg--line-height:1.75rem;--font-size-xl:1.25rem;--font-size-xl--line-height:1.75rem;--font-size-2xl:1.5rem;--font-size-2xl--line-height:2rem;--font-size-3xl:1.875rem;--font-size-3xl--line-height:2.25rem;--font-size-4xl:2.25rem;--font-size-4xl--line-height:2.5rem;--font-size-5xl:3rem;--font-size-5xl--line-height:1;--font-size-6xl:3.75rem;--font-size-6xl--line-height:1;--font-size-7xl:4.5rem;--font-size-7xl--line-height:1;--font-size-8xl:6rem;--font-size-8xl--line-height:1;--font-size-9xl:8rem;--font-size-9xl--line-height:1;--letter-spacing-tighter:-.05em;--letter-spacing-tight:-.025em;--letter-spacing-normal:0em;--letter-spacing-wide:.025em;--letter-spacing-wider:.05em;--letter-spacing-widest:.1em;--line-height-none:1;--line-height-tight:1.25;--line-height-snug:1.375;--line-height-normal:1.5;--line-height-relaxed:1.625;--line-height-loose:2;--line-height-3:.75rem;--line-height-4:1rem;--line-height-5:1.25rem;--line-height-6:1.5rem;--line-height-7:1.75rem;--line-height-8:2rem;--line-height-9:2.25rem;--line-height-10:2.5rem;--perspective-dramatic:100px;--perspective-near:300px;--perspective-normal:500px;--perspective-midrange:800px;--perspective-distant:1200px;--transition-timing-function-linear:linear;--transition-timing-function-in:cubic-bezier(.4,0,1,1);--transition-timing-function-out:cubic-bezier(0,0,.2,1);--transition-timing-function-in-out:cubic-bezier(.4,0,.2,1)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}body{line-height:inherit}hr{color:inherit;border-top-width:1px;height:0}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;background:0 0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;background:0 0}input:where(:not([type=button],[type=reset],[type=submit])),select,textarea{border:1px solid}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}::-webkit-search-decoration{-webkit-appearance:none}summary{display:list-item}ol,ul,menu{list-style:none}textarea{resize:vertical}::placeholder{opacity:1;color:color-mix(in srgb,currentColor 50%,transparent)}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}[hidden]{display:none!important}}@layer components;@layer utilities{.invisible{visibility:hidden}.visible{visibility:visible}.sr-only{clip:rect(0,0,0,0);white-space:nowrap;border-width:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}.absolute{position:absolute}.static,.static\/Loader,.static\/Toast,.static\/index,.static\/types{position:static}.block{display:block}.hidden{display:none}.table{display:table}.transform{transform:var(--tw-rotate-x)var(--tw-rotate-y)var(--tw-rotate-z)var(--tw-skew-x)var(--tw-skew-y)}.border{border-style:var(--tw-border-style);border-width:1px}.blur{--tw-blur:blur(8px);filter:var(--tw-blur,)var(--tw-brightness,)var(--tw-contrast,)var(--tw-grayscale,)var(--tw-hue-rotate,)var(--tw-invert,)var(--tw-saturate,)var(--tw-sepia,)var(--tw-drop-shadow,)}.filter{filter:var(--tw-blur,)var(--tw-brightness,)var(--tw-contrast,)var(--tw-grayscale,)var(--tw-hue-rotate,)var(--tw-invert,)var(--tw-saturate,)var(--tw-sepia,)var(--tw-drop-shadow,)}.transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,-webkit-backdrop-filter,backdrop-filter;transition-duration:.15s;transition-timing-function:cubic-bezier(.4,0,.2,1)}.ease-in-out{transition-timing-function:var(--transition-timing-function-in-out,cubic-bezier(.4,0,.2,1))}}@keyframes spin{to{transform:rotate(360deg)}}@keyframes ping{75%,to{opacity:0;transform:scale(2)}}@keyframes pulse{50%{opacity:.5}}@keyframes bounce{0%,to{animation-timing-function:cubic-bezier(.8,0,1,1);transform:translateY(-25%)}50%{animation-timing-function:cubic-bezier(0,0,.2,1);transform:none}}@property --tw-rotate-x{syntax:"<transform-function>";inherits:false;initial-value:rotateX(0)}@property --tw-rotate-y{syntax:"<transform-function>";inherits:false;initial-value:rotateY(0)}@property --tw-rotate-z{syntax:"<transform-function>";inherits:false;initial-value:rotate(0)}@property --tw-skew-x{syntax:"<transform-function>";inherits:false;initial-value:skew(0)}@property --tw-skew-y{syntax:"<transform-function>";inherits:false;initial-value:skewY(0)}@property --tw-border-style{syntax:"<custom-ident>";inherits:false;initial-value:solid}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}.block.svelte-nl1om8{position:relative;margin:0;box-shadow:var(--block-shadow);border-width:var(--block-border-width);border-color:var(--block-border-color);border-radius:var(--block-radius);background:var(--block-background-fill);width:100%;line-height:var(--line-sm)}.block.border_focus.svelte-nl1om8{border-color:var(--color-accent)}.block.border_contrast.svelte-nl1om8{border-color:var(--body-text-color)}.padded.svelte-nl1om8{padding:var(--block-padding)}.hidden.svelte-nl1om8{display:none}.hide-container.svelte-nl1om8{margin:0;box-shadow:none;--block-border-width:0;background:transparent;padding:0;overflow:visible}div.svelte-1hnfib2{margin-bottom:var(--spacing-lg);color:var(--block-info-text-color);font-weight:var(--block-info-text-weight);font-size:var(--block-info-text-size);line-height:var(--line-sm)}span.has-info.svelte-22c38v{margin-bottom:var(--spacing-xs)}span.svelte-22c38v:not(.has-info){margin-bottom:var(--spacing-lg)}span.svelte-22c38v{display:inline-block;position:relative;z-index:var(--layer-4);border:solid var(--block-title-border-width) var(--block-title-border-color);border-radius:var(--block-title-radius);background:var(--block-title-background-fill);padding:var(--block-title-padding);color:var(--block-title-text-color);font-weight:var(--block-title-text-weight);font-size:var(--block-title-text-size);line-height:var(--line-sm)}.hide.svelte-22c38v{margin:0;height:0}label.svelte-9gxdi0{display:inline-flex;align-items:center;z-index:var(--layer-2);box-shadow:var(--block-label-shadow);border:var(--block-label-border-width) solid var(--border-color-primary);border-top:none;border-left:none;border-radius:var(--block-label-radius);background:var(--block-label-background-fill);padding:var(--block-label-padding);pointer-events:none;color:var(--block-label-text-color);font-weight:var(--block-label-text-weight);font-size:var(--block-label-text-size);line-height:var(--line-sm)}.gr-group label.svelte-9gxdi0{border-top-left-radius:0}label.float.svelte-9gxdi0{position:absolute;top:var(--block-label-margin);left:var(--block-label-margin)}label.svelte-9gxdi0:not(.float){position:static;margin-top:var(--block-label-margin);margin-left:var(--block-label-margin)}.hide.svelte-9gxdi0{height:0}span.svelte-9gxdi0{opacity:.8;margin-right:var(--size-2);width:calc(var(--block-label-text-size) - 1px);height:calc(var(--block-label-text-size) - 1px)}.hide-label.svelte-9gxdi0{box-shadow:none;border-width:0;background:transparent;overflow:visible}button.svelte-1lrphxw{display:flex;justify-content:center;align-items:center;gap:1px;z-index:var(--layer-2);border-radius:var(--radius-sm);color:var(--block-label-text-color);border:1px solid transparent}button[disabled].svelte-1lrphxw{opacity:.5;box-shadow:none}button[disabled].svelte-1lrphxw:hover{cursor:not-allowed}.padded.svelte-1lrphxw{padding:2px;background:var(--bg-color);box-shadow:var(--shadow-drop);border:1px solid var(--button-secondary-border-color)}button.svelte-1lrphxw:hover,button.highlight.svelte-1lrphxw{cursor:pointer;color:var(--color-accent)}.padded.svelte-1lrphxw:hover{border:2px solid var(--button-secondary-border-color-hover);padding:1px;color:var(--block-label-text-color)}span.svelte-1lrphxw{padding:0 1px;font-size:10px}div.svelte-1lrphxw{padding:2px;display:flex;align-items:flex-end}.small.svelte-1lrphxw{width:14px;height:14px}.medium.svelte-1lrphxw{width:20px;height:20px}.large.svelte-1lrphxw{width:22px;height:22px}.pending.svelte-1lrphxw{animation:svelte-1lrphxw-flash .5s infinite}@keyframes svelte-1lrphxw-flash{0%{opacity:.5}50%{opacity:1}to{opacity:.5}}.transparent.svelte-1lrphxw{background:transparent;border:none;box-shadow:none}.empty.svelte-3w3rth{display:flex;justify-content:center;align-items:center;margin-top:calc(0px - var(--size-6));height:var(--size-full)}.icon.svelte-3w3rth{opacity:.5;height:var(--size-5);color:var(--body-text-color)}.small.svelte-3w3rth{min-height:calc(var(--size-32) - 20px)}.large.svelte-3w3rth{min-height:calc(var(--size-64) - 20px)}.unpadded_box.svelte-3w3rth{margin-top:0}.small_parent.svelte-3w3rth{min-height:100%!important}.dropdown-arrow.svelte-145leq6{fill:currentColor}.wrap.svelte-kzcjhc{display:flex;flex-direction:column;justify-content:center;align-items:center;min-height:var(--size-60);color:var(--block-label-text-color);line-height:var(--line-md);height:100%;padding-top:var(--size-3)}.or.svelte-kzcjhc{color:var(--body-text-color-subdued);display:flex}.icon-wrap.svelte-kzcjhc{width:30px;margin-bottom:var(--spacing-lg)}@media (--screen-md){.wrap.svelte-kzcjhc{font-size:var(--text-lg)}}.hovered.svelte-kzcjhc{color:var(--color-accent)}div.svelte-q32hvf{border-top:1px solid transparent;display:flex;max-height:100%;justify-content:center;align-items:center;gap:var(--spacing-sm);height:auto;align-items:flex-end;color:var(--block-label-text-color);flex-shrink:0}.show_border.svelte-q32hvf{border-top:1px solid var(--block-border-color);margin-top:var(--spacing-xxl);box-shadow:var(--shadow-drop)}.source-selection.svelte-1jp3vgd{display:flex;align-items:center;justify-content:center;border-top:1px solid var(--border-color-primary);width:95%;bottom:0;left:0;right:0;margin-left:auto;margin-right:auto}.icon.svelte-1jp3vgd{width:22px;height:22px;margin:var(--spacing-lg) var(--spacing-xs);padding:var(--spacing-xs);color:var(--neutral-400);border-radius:var(--radius-md)}.selected.svelte-1jp3vgd{color:var(--color-accent)}.icon.svelte-1jp3vgd:hover,.icon.svelte-1jp3vgd:focus{color:var(--color-accent)}svg.svelte-43sxxs.svelte-43sxxs{width:var(--size-20);height:var(--size-20)}svg.svelte-43sxxs path.svelte-43sxxs{fill:var(--loader-color)}div.svelte-43sxxs.svelte-43sxxs{z-index:var(--layer-2)}.margin.svelte-43sxxs.svelte-43sxxs{margin:var(--size-4)}.wrap.svelte-1yk38uw.svelte-1yk38uw{display:flex;flex-direction:column;justify-content:center;align-items:center;z-index:var(--layer-top);transition:opacity .1s ease-in-out;border-radius:var(--block-radius);background:var(--block-background-fill);padding:0 var(--size-6);max-height:var(--size-screen-h);overflow:hidden}.wrap.center.svelte-1yk38uw.svelte-1yk38uw{top:0;right:0;left:0}.wrap.default.svelte-1yk38uw.svelte-1yk38uw{inset:0}.hide.svelte-1yk38uw.svelte-1yk38uw{opacity:0;pointer-events:none}.generating.svelte-1yk38uw.svelte-1yk38uw{animation:svelte-1yk38uw-pulse 2s cubic-bezier(.4,0,.6,1) infinite;border:2px solid var(--color-accent);background:transparent;z-index:var(--layer-1)}.translucent.svelte-1yk38uw.svelte-1yk38uw{background:none}@keyframes svelte-1yk38uw-pulse{0%,to{opacity:1}50%{opacity:.5}}.loading.svelte-1yk38uw.svelte-1yk38uw{z-index:var(--layer-2);color:var(--body-text-color)}.eta-bar.svelte-1yk38uw.svelte-1yk38uw{position:absolute;inset:0;transform-origin:left;opacity:.8;z-index:var(--layer-1);transition:10ms;background:var(--background-fill-secondary)}.progress-bar-wrap.svelte-1yk38uw.svelte-1yk38uw{border:1px solid var(--border-color-primary);background:var(--background-fill-primary);width:55.5%;height:var(--size-4)}.progress-bar.svelte-1yk38uw.svelte-1yk38uw{transform-origin:left;background-color:var(--loader-color);width:var(--size-full);height:var(--size-full)}.progress-level.svelte-1yk38uw.svelte-1yk38uw{display:flex;flex-direction:column;align-items:center;gap:1;z-index:var(--layer-2);width:var(--size-full)}.progress-level-inner.svelte-1yk38uw.svelte-1yk38uw{margin:var(--size-2) auto;color:var(--body-text-color);font-size:var(--text-sm);font-family:var(--font-mono)}.meta-text.svelte-1yk38uw.svelte-1yk38uw{position:absolute;top:0;right:0;z-index:var(--layer-2);padding:var(--size-1) var(--size-2);font-size:var(--text-sm);font-family:var(--font-mono)}.meta-text-center.svelte-1yk38uw.svelte-1yk38uw{display:flex;position:absolute;top:0;right:0;justify-content:center;align-items:center;transform:translateY(var(--size-6));z-index:var(--layer-2);padding:var(--size-1) var(--size-2);font-size:var(--text-sm);font-family:var(--font-mono);text-align:center}.error.svelte-1yk38uw.svelte-1yk38uw{box-shadow:var(--shadow-drop);border:solid 1px var(--error-border-color);border-radius:var(--radius-full);background:var(--error-background-fill);padding-right:var(--size-4);padding-left:var(--size-4);color:var(--error-text-color);font-weight:var(--weight-semibold);font-size:var(--text-lg);line-height:var(--line-lg);font-family:var(--font)}.minimal.svelte-1yk38uw .progress-text.svelte-1yk38uw{background:var(--block-background-fill)}.border.svelte-1yk38uw.svelte-1yk38uw{border:1px solid var(--border-color-primary)}.clear-status.svelte-1yk38uw.svelte-1yk38uw{position:absolute;display:flex;top:var(--size-2);right:var(--size-2);justify-content:flex-end;gap:var(--spacing-sm);z-index:var(--layer-1)}.toast-body.svelte-solcu7{display:flex;position:relative;right:0;left:0;align-items:center;margin:var(--size-6) var(--size-4);margin:auto;border-radius:var(--container-radius);overflow:hidden;pointer-events:auto}.toast-body.error.svelte-solcu7{border:1px solid var(--color-red-700);background:var(--color-red-50)}.dark .toast-body.error.svelte-solcu7{border:1px solid var(--color-red-500);background-color:var(--color-grey-950)}.toast-body.warning.svelte-solcu7{border:1px solid var(--color-yellow-700);background:var(--color-yellow-50)}.dark .toast-body.warning.svelte-solcu7{border:1px solid var(--color-yellow-500);background-color:var(--color-grey-950)}.toast-body.info.svelte-solcu7{border:1px solid var(--color-grey-700);background:var(--color-grey-50)}.dark .toast-body.info.svelte-solcu7{border:1px solid var(--color-grey-500);background-color:var(--color-grey-950)}.toast-title.svelte-solcu7{display:flex;align-items:center;font-weight:var(--weight-bold);font-size:var(--text-lg);line-height:var(--line-sm);text-transform:capitalize}.toast-title.error.svelte-solcu7{color:var(--color-red-700)}.dark .toast-title.error.svelte-solcu7{color:var(--color-red-50)}.toast-title.warning.svelte-solcu7{color:var(--color-yellow-700)}.dark .toast-title.warning.svelte-solcu7{color:var(--color-yellow-50)}.toast-title.info.svelte-solcu7{color:var(--color-grey-700)}.dark .toast-title.info.svelte-solcu7{color:var(--color-grey-50)}.toast-close.svelte-solcu7{margin:0 var(--size-3);border-radius:var(--size-3);padding:0px var(--size-1-5);font-size:var(--size-5);line-height:var(--size-5)}.toast-close.error.svelte-solcu7{color:var(--color-red-700)}.dark .toast-close.error.svelte-solcu7{color:var(--color-red-500)}.toast-close.warning.svelte-solcu7{color:var(--color-yellow-700)}.dark .toast-close.warning.svelte-solcu7{color:var(--color-yellow-500)}.toast-close.info.svelte-solcu7{color:var(--color-grey-700)}.dark .toast-close.info.svelte-solcu7{color:var(--color-grey-500)}.toast-text.svelte-solcu7{font-size:var(--text-lg)}.toast-text.error.svelte-solcu7{color:var(--color-red-700)}.dark .toast-text.error.svelte-solcu7{color:var(--color-red-50)}.toast-text.warning.svelte-solcu7{color:var(--color-yellow-700)}.dark .toast-text.warning.svelte-solcu7{color:var(--color-yellow-50)}.toast-text.info.svelte-solcu7{color:var(--color-grey-700)}.dark .toast-text.info.svelte-solcu7{color:var(--color-grey-50)}.toast-details.svelte-solcu7{margin:var(--size-3) var(--size-3) var(--size-3) 0;width:100%}.toast-icon.svelte-solcu7{display:flex;position:absolute;position:relative;flex-shrink:0;justify-content:center;align-items:center;margin:var(--size-2);border-radius:var(--radius-full);padding:var(--size-1);padding-left:calc(var(--size-1) - 1px);width:35px;height:35px}.toast-icon.error.svelte-solcu7{color:var(--color-red-700)}.dark .toast-icon.error.svelte-solcu7{color:var(--color-red-500)}.toast-icon.warning.svelte-solcu7{color:var(--color-yellow-700)}.dark .toast-icon.warning.svelte-solcu7{color:var(--color-yellow-500)}.toast-icon.info.svelte-solcu7{color:var(--color-grey-700)}.dark .toast-icon.info.svelte-solcu7{color:var(--color-grey-500)}@keyframes svelte-solcu7-countdown{0%{transform:scaleX(1)}to{transform:scaleX(0)}}.timer.svelte-solcu7{position:absolute;bottom:0;left:0;transform-origin:0 0;animation:svelte-solcu7-countdown 10s linear forwards;width:100%;height:var(--size-1)}.timer.error.svelte-solcu7{background:var(--color-red-700)}.dark .timer.error.svelte-solcu7{background:var(--color-red-500)}.timer.warning.svelte-solcu7{background:var(--color-yellow-700)}.dark .timer.warning.svelte-solcu7{background:var(--color-yellow-500)}.timer.info.svelte-solcu7{background:var(--color-grey-700)}.dark .timer.info.svelte-solcu7{background:var(--color-grey-500)}.toast-wrap.svelte-gatr8h{display:flex;position:fixed;top:var(--size-4);right:var(--size-4);flex-direction:column;align-items:end;gap:var(--size-2);z-index:var(--layer-top);width:calc(100% - var(--size-8))}@media (--screen-sm){.toast-wrap.svelte-gatr8h{width:calc(var(--size-96) + var(--size-10))}}.container.svelte-giydt1 img{width:100%;height:100%}.container.selected.svelte-giydt1.svelte-giydt1{border-color:var(--border-color-accent)}.container.table.svelte-giydt1.svelte-giydt1{margin:0 auto;border:2px solid var(--border-color-primary);border-radius:var(--radius-lg);overflow:hidden;width:var(--size-20);height:var(--size-20);object-fit:cover}.container.gallery.svelte-giydt1.svelte-giydt1{height:var(--size-20);max-height:var(--size-20);object-fit:cover}.container.svelte-giydt1 img.svelte-giydt1{object-fit:cover}div.viewer.svelte-mo2zro{width:100%}div.viewer.svelte-mo2zro>canvas{position:initial!important;top:unset!important;width:100%;height:100%}
src/demo/app.py CHANGED
@@ -1,64 +1,150 @@
 
 
 
 
 
1
  import gradio as gr
2
  from gradio_rerun import Rerun
3
 
 
 
4
 
5
- example = Rerun().example_value()
6
 
 
 
 
7
 
8
- def predict(url: str, file_path: str | list[str] | None):
9
- if url:
10
- return url
11
- return file_path
12
 
 
 
 
 
 
 
 
 
13
 
14
- with gr.Blocks(css=".gradio-container { max-width: unset!important; }") as demo:
15
- with gr.Row():
16
- with gr.Column():
17
- with gr.Group():
18
- file_path = gr.File(file_count="multiple", type="filepath")
19
- url = gr.Text(
20
- info="Or use a URL",
21
- label="URL",
22
- )
23
- with gr.Column():
24
- pass
25
- btn = gr.Button("Run", scale=0)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
26
  with gr.Row():
27
- rerun_viewer = Rerun(height=900)
28
-
29
- inputs = [file_path, url]
30
- outputs = [rerun_viewer]
31
-
32
- gr.on([btn.click, file_path.upload], fn=predict, inputs=inputs, outputs=outputs)
33
-
34
- gr.Examples(
35
- examples=[
36
- [
37
- None,
38
- "https://app.rerun.io/version/0.15.1/examples/detect_and_track_objects.rrd",
39
- ],
40
- [
41
- ["./examples/rgbd.rrd"],
42
- None,
43
- ],
44
- [
45
- ["./examples/rrt-star.rrd"],
46
- None,
47
- ],
48
- [
49
- ["./examples/structure_from_motion.rrd"],
50
- None,
51
- ],
52
- [
53
- ["./examples/structure_from_motion.rrd", "./examples/rrt-star.rrd"],
54
- None,
55
- ],
56
- ],
57
- fn=predict,
58
- inputs=inputs,
59
- outputs=outputs,
60
- run_on_click=True,
61
  )
62
 
 
 
 
63
  if __name__ == "__main__":
64
  demo.launch()
 
1
+ import cv2
2
+ import os
3
+ import tempfile
4
+ import time
5
+
6
  import gradio as gr
7
  from gradio_rerun import Rerun
8
 
9
+ import rerun as rr
10
+ import rerun.blueprint as rrb
11
 
12
+ from color_grid import build_color_grid
13
 
14
+ # NOTE: Functions that work with Rerun should be decorated with `@rr.thread_local_stream`.
15
+ # This decorator creates a generator-aware thread-local context so that rerun log calls
16
+ # across multiple workers stay isolated.
17
 
 
 
 
 
18
 
19
+ # A task can directly log to a binary stream, which is routed to the embedded viewer.
20
+ # Incremental chunks are yielded to the viewer using `yield stream.read()`.
21
+ #
22
+ # This is the preferred way to work with Rerun in Gradio since your data can be immediately and
23
+ # incrementally seen by the viewer. Also, there are no ephemeral RRDs to cleanup or manage.
24
+ @rr.thread_local_stream("rerun_example_streaming_blur")
25
+ def streaming_repeated_blur(img):
26
+ stream = rr.binary_stream()
27
 
28
+ if img is None:
29
+ raise gr.Error("Must provide an image to blur.")
30
+
31
+ blueprint = rrb.Blueprint(
32
+ rrb.Horizontal(
33
+ rrb.Spatial2DView(origin="image/original"),
34
+ rrb.Spatial2DView(origin="image/blurred"),
35
+ ),
36
+ collapse_panels=True,
37
+ )
38
+
39
+ rr.send_blueprint(blueprint)
40
+
41
+ rr.set_time_sequence("iteration", 0)
42
+
43
+ rr.log("image/original", rr.Image(img))
44
+ yield stream.read()
45
+
46
+ blur = img
47
+
48
+ for i in range(100):
49
+ rr.set_time_sequence("iteration", i)
50
+
51
+ # Pretend blurring takes a while so we can see streaming in action.
52
+ time.sleep(0.1)
53
+ blur = cv2.GaussianBlur(blur, (5, 5), 0)
54
+
55
+ rr.log("image/blurred", rr.Image(blur))
56
+
57
+ # Each time we yield bytes from the stream back to Gradio, they
58
+ # are incrementally sent to the viewer. Make sure to yield any time
59
+ # you want the user to be able to see progress.
60
+ yield stream.read()
61
+
62
+
63
+ # However, if you have a workflow that creates an RRD file instead, you can still send it
64
+ # directly to the viewer by simply returning the path to the RRD file.
65
+ #
66
+ # This may be helpful if you need to execute a helper tool written in C++ or Rust that can't
67
+ # be easily modified to stream data directly via Gradio.
68
+ #
69
+ # In this case you may want to clean up the RRD file after it's sent to the viewer so that you
70
+ # don't accumulate too many temporary files.
71
+ @rr.thread_local_stream("rerun_example_cube_rrd")
72
+ def create_cube_rrd(x, y, z, pending_cleanup):
73
+ cube = build_color_grid(int(x), int(y), int(z), twist=0)
74
+ rr.log("cube", rr.Points3D(cube.positions, colors=cube.colors, radii=0.5))
75
+
76
+ # We eventually want to clean up the RRD file after it's sent to the viewer, so tracking
77
+ # any pending files to be cleaned up when the state is deleted.
78
+ temp = tempfile.NamedTemporaryFile(prefix="cube_", suffix=".rrd", delete=False)
79
+ pending_cleanup.append(temp.name)
80
+
81
+ blueprint = rrb.Spatial3DView(origin="cube")
82
+ rr.save(temp.name, default_blueprint=blueprint)
83
+
84
+ # Just return the name of the file -- Gradio will convert it to a FileData object
85
+ # and send it to the viewer.
86
+ return temp.name
87
+
88
+
89
+ def cleanup_cube_rrds(pending_cleanup):
90
+ for f in pending_cleanup:
91
+ os.unlink(f)
92
+
93
+
94
+ with gr.Blocks() as demo:
95
+ with gr.Tab("Streaming"):
96
+ with gr.Row():
97
+ img = gr.Image(interactive=True, label="Image")
98
+ with gr.Column():
99
+ stream_blur = gr.Button("Stream Repeated Blur")
100
+
101
+ with gr.Tab("Dynamic RRD"):
102
+ pending_cleanup = gr.State(
103
+ [], time_to_live=10, delete_callback=cleanup_cube_rrds
104
+ )
105
+ with gr.Row():
106
+ x_count = gr.Number(
107
+ minimum=1, maximum=10, value=5, precision=0, label="X Count"
108
+ )
109
+ y_count = gr.Number(
110
+ minimum=1, maximum=10, value=5, precision=0, label="Y Count"
111
+ )
112
+ z_count = gr.Number(
113
+ minimum=1, maximum=10, value=5, precision=0, label="Z Count"
114
+ )
115
+ with gr.Row():
116
+ create_rrd = gr.Button("Create RRD")
117
+
118
+ with gr.Tab("Hosted RRD"):
119
+ with gr.Row():
120
+ # It may be helpful to point the viewer to a hosted RRD file on another server.
121
+ # If an RRD file is hosted via http, you can just return a URL to the file.
122
+ choose_rrd = gr.Dropdown(
123
+ label="RRD",
124
+ choices=[
125
+ f"{rr.bindings.get_app_url()}/examples/arkit_scenes.rrd",
126
+ f"{rr.bindings.get_app_url()}/examples/dna.rrd",
127
+ f"{rr.bindings.get_app_url()}/examples/plots.rrd",
128
+ ],
129
+ )
130
+
131
+ # Rerun 0.16 has issues when embedded in a Gradio tab, so we share a viewer between all the tabs.
132
+ # In 0.17 we can instead scope each viewer to its own tab to clean up these examples further.
133
  with gr.Row():
134
+ viewer = Rerun(
135
+ streaming=True,
136
+ )
137
+
138
+ stream_blur.click(streaming_repeated_blur, inputs=[img], outputs=[viewer])
139
+
140
+ create_rrd.click(
141
+ create_cube_rrd,
142
+ inputs=[x_count, y_count, z_count, pending_cleanup],
143
+ outputs=[viewer],
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
144
  )
145
 
146
+ choose_rrd.change(lambda x: x, inputs=[choose_rrd], outputs=[viewer])
147
+
148
+
149
  if __name__ == "__main__":
150
  demo.launch()
src/demo/color_grid.py ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import numpy as np
2
+ from math import cos, sin
3
+ from collections import namedtuple
4
+
5
+ ColorGrid = namedtuple("ColorGrid", ["positions", "colors"])
6
+
7
+
8
+ def build_color_grid(x_count=10, y_count=10, z_count=10, twist=0):
9
+ """
10
+ Create a cube of points with colors.
11
+
12
+ The total point cloud will have x_count * y_count * z_count points.
13
+
14
+ Parameters
15
+ ----------
16
+ x_count, y_count, z_count:
17
+ Number of points in each dimension.
18
+ twist:
19
+ Angle to twist from bottom to top of the cube
20
+
21
+ """
22
+
23
+ grid = np.mgrid[
24
+ slice(-x_count, x_count, x_count * 1j),
25
+ slice(-y_count, y_count, y_count * 1j),
26
+ slice(-z_count, z_count, z_count * 1j),
27
+ ]
28
+
29
+ angle = np.linspace(-float(twist) / 2, float(twist) / 2, z_count)
30
+ for z in range(z_count):
31
+ xv, yv, zv = grid[:, :, :, z]
32
+ rot_xv = xv * cos(angle[z]) - yv * sin(angle[z])
33
+ rot_yv = xv * sin(angle[z]) + yv * cos(angle[z])
34
+ grid[:, :, :, z] = [rot_xv, rot_yv, zv]
35
+
36
+ positions = np.vstack([xyz.ravel() for xyz in grid])
37
+
38
+ colors = np.vstack(
39
+ [
40
+ xyz.ravel()
41
+ for xyz in np.mgrid[
42
+ slice(0, 255, x_count * 1j),
43
+ slice(0, 255, y_count * 1j),
44
+ slice(0, 255, z_count * 1j),
45
+ ]
46
+ ]
47
+ )
48
+
49
+ return ColorGrid(positions.T, colors.T.astype(np.uint8))
src/demo/requirements.txt CHANGED
@@ -1 +1,2 @@
1
- gradio_rerun
 
 
1
+ gradio_rerun
2
+ opencv-python
src/demo/space.py CHANGED
@@ -3,7 +3,7 @@ import gradio as gr
3
  from app import demo as app
4
  import os
5
 
6
- _docs = {'Rerun': {'description': 'Creates an image component that can be used to upload images (as an input) or display images (as an output).', 'members': {'__init__': {'value': {'type': 'list[str] | None', 'default': 'None', 'description': 'A path or URL for the default value that Rerun component is going to take. If callable, the function will be called whenever the app loads to set the initial value of the component.'}, 'label': {'type': 'str | None', 'default': 'None', 'description': 'The label for this component. Appears above the component and is also used as the header if there are a table of examples for this component. If None and used in a `gr.Interface`, the label will be the name of the parameter this component is assigned to.'}, 'every': {'type': 'float | None', 'default': 'None', 'description': "If `value` is a callable, run the function 'every' number of seconds while the client connection is open. Has no effect otherwise. Queue must be enabled. The event can be accessed (e.g. to cancel it) via this component's .load_event attribute."}, 'show_label': {'type': 'bool | None', 'default': 'None', 'description': 'if True, will display label.'}, 'show_download_button': {'type': 'bool', 'default': 'True', 'description': 'If True, will display button to download image.'}, 'container': {'type': 'bool', 'default': 'True', 'description': 'If True, will place the component in a container - providing some extra padding around the border.'}, 'scale': {'type': 'int | None', 'default': 'None', 'description': 'relative size compared to adjacent Components. For example if Components A and B are in a Row, and A has scale=2, and B has scale=1, A will be twice as wide as B. Should be an integer. scale applies in Rows, and to top-level Components in Blocks where fill_height=True.'}, 'min_width': {'type': 'int', 'default': '160', 'description': 'minimum pixel width, will wrap if not sufficient screen space to satisfy this value. If a certain scale value results in this Component being narrower than min_width, the min_width parameter will be respected first.'}, 'height': {'type': 'int | str', 'default': '640', 'description': 'height of component in pixels. If a string is provided, will be interpreted as a CSS value. If None, will be set to 640px.'}, 'interactive': {'type': 'bool | None', 'default': 'None', 'description': 'if True, will allow users to upload and edit an image; if False, can only be used to display images. If not provided, this is inferred based on whether the component is used as an input or output.'}, 'visible': {'type': 'bool', 'default': 'True', 'description': 'If False, component 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 list of strings that are assigned as the classes of this component in the HTML DOM. Can be used for targeting CSS styles.'}, 'render': {'type': 'bool', 'default': 'True', 'description': 'If False, component will not render be rendered in the Blocks context. Should be used if the intention is to assign event listeners now but render the component later.'}}, 'postprocess': {'value': {'type': 'list[gradio.data_classes.FileData]\n | gradio.data_classes.FileData\n | str\n | list[str]', 'description': 'Expects a `str` or `pathlib.Path` object containing the path to the image.'}}, 'preprocess': {'return': {'type': 'str | None', 'description': 'A `str` containing the path to the image.'}, 'value': None}}, 'events': {'clear': {'type': None, 'default': None, 'description': 'This listener is triggered when the user clears the Rerun using the X button for the component.'}, 'change': {'type': None, 'default': None, 'description': 'Triggered when the value of the Rerun changes either because of user input (e.g. a user types in a textbox) OR because of a function update (e.g. an image receives a value from the output of an event trigger). See `.input()` for a listener that is only triggered by user input.'}, 'upload': {'type': None, 'default': None, 'description': 'This listener is triggered when the user uploads a file into the Rerun.'}}}, '__meta__': {'additional_interfaces': {}, 'user_fn_refs': {'Rerun': []}}}
7
 
8
  abs_path = os.path.join(os.path.dirname(__file__), "css.css")
9
 
@@ -21,7 +21,7 @@ with gr.Blocks(
21
  # `gradio_rerun`
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"> <a href="https://github.com/radames/gradio-rerun-viewer/issues" target="_blank"><img alt="Static Badge" src="https://img.shields.io/badge/Issues-white?logo=github&logoColor=black"></a>
25
  </div>
26
 
27
  Rerun viewer with Gradio
@@ -38,68 +38,154 @@ pip install gradio_rerun
38
  ## Usage
39
 
40
  ```python
 
 
 
 
 
41
  import gradio as gr
42
  from gradio_rerun import Rerun
43
 
 
 
44
 
45
- example = Rerun().example_value()
46
 
 
 
 
47
 
48
- def predict(url: str, file_path: str | list[str] | None):
49
- if url:
50
- return url
51
- return file_path
52
 
 
 
 
 
 
 
 
 
53
 
54
- with gr.Blocks(css=".gradio-container { max-width: unset!important; }") as demo:
55
- with gr.Row():
56
- with gr.Column():
57
- with gr.Group():
58
- file_path = gr.File(file_count="multiple", type="filepath")
59
- url = gr.Text(
60
- info="Or use a URL",
61
- label="URL",
62
- )
63
- with gr.Column():
64
- pass
65
- btn = gr.Button("Run", scale=0)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
66
  with gr.Row():
67
- rerun_viewer = Rerun(height=900)
68
-
69
- inputs = [file_path, url]
70
- outputs = [rerun_viewer]
71
-
72
- gr.on([btn.click, file_path.upload], fn=predict, inputs=inputs, outputs=outputs)
73
-
74
- gr.Examples(
75
- examples=[
76
- [
77
- None,
78
- "https://app.rerun.io/version/0.15.1/examples/detect_and_track_objects.rrd",
79
- ],
80
- [
81
- ["./examples/rgbd.rrd"],
82
- None,
83
- ],
84
- [
85
- ["./examples/rrt-star.rrd"],
86
- None,
87
- ],
88
- [
89
- ["./examples/structure_from_motion.rrd"],
90
- None,
91
- ],
92
- [
93
- ["./examples/structure_from_motion.rrd", "./examples/rrt-star.rrd"],
94
- None,
95
- ],
96
- ],
97
- fn=predict,
98
- inputs=inputs,
99
- outputs=outputs,
100
- run_on_click=True,
101
  )
102
 
 
 
 
103
  if __name__ == "__main__":
104
  demo.launch()
105
 
@@ -113,11 +199,7 @@ if __name__ == "__main__":
113
  ### Initialization
114
  """, elem_classes=["md-custom"], header_links=True)
115
 
116
- gr.ParamViewer(value=_docs["Rerun"]["members"]["__init__"], linkify=[])
117
-
118
-
119
- gr.Markdown("### Events")
120
- gr.ParamViewer(value=_docs["Rerun"]["events"], linkify=['Event'])
121
 
122
 
123
 
@@ -133,16 +215,13 @@ The impact on the users predict function varies depending on whether the compone
133
 
134
  The code snippet below is accurate in cases where the component is used as both an input and an output.
135
 
136
- - **As input:** Is passed, a `str` containing the path to the image.
137
- - **As output:** Should return, expects a `str` or `pathlib.Path` object containing the path to the image.
138
 
139
  ```python
140
  def predict(
141
- value: str | None
142
- ) -> list[gradio.data_classes.FileData]
143
- | gradio.data_classes.FileData
144
- | str
145
- | list[str]:
146
  return value
147
  ```
148
  """, elem_classes=["md-custom", "Rerun-user-fn"], header_links=True)
@@ -150,10 +229,18 @@ def predict(
150
 
151
 
152
 
 
 
 
 
 
 
 
153
  demo.load(None, js=r"""function() {
154
- const refs = {};
 
155
  const user_fn_refs = {
156
- Rerun: [], };
157
  requestAnimationFrame(() => {
158
 
159
  Object.entries(user_fn_refs).forEach(([key, refs]) => {
 
3
  from app import demo as app
4
  import os
5
 
6
+ _docs = {'Rerun': {'description': 'Creates a Rerun viewer component that can be used to display the output of a Rerun stream.', 'members': {'__init__': {'value': {'type': 'list[pathlib.Path | str]\n | pathlib.Path\n | str\n | bytes\n | Callable\n | None', 'default': 'None', 'description': 'Takes a singular or list of RRD resources. Each RRD can be a Path, a string containing a url, or a binary blob containing encoded RRD data. If callable, the function will be called whenever the app loads to set the initial value of the component.'}, 'label': {'type': 'str | None', 'default': 'None', 'description': 'The label for this component. Appears above the component and is also used as the header if there are a table of examples for this component. If None and used in a `gr.Interface`, the label will be the name of the parameter this component is assigned to.'}, 'every': {'type': 'float | None', 'default': 'None', 'description': "If `value` is a callable, run the function 'every' number of seconds while the client connection is open. Has no effect otherwise. Queue must be enabled. The event can be accessed (e.g. to cancel it) via this component's .load_event attribute."}, 'show_label': {'type': 'bool | None', 'default': 'None', 'description': 'if True, will display label.'}, 'container': {'type': 'bool', 'default': 'True', 'description': 'If True, will place the component in a container - providing some extra padding around the border.'}, 'scale': {'type': 'int | None', 'default': 'None', 'description': 'relative size compared to adjacent Components. For example if Components A and B are in a Row, and A has scale=2, and B has scale=1, A will be twice as wide as B. Should be an integer. scale applies in Rows, and to top-level Components in Blocks where fill_height=True.'}, 'min_width': {'type': 'int', 'default': '160', 'description': 'minimum pixel width, will wrap if not sufficient screen space to satisfy this value. If a certain scale value results in this Component being narrower than min_width, the min_width parameter will be respected first.'}, 'height': {'type': 'int | str', 'default': '640', 'description': 'height of component in pixels. If a string is provided, will be interpreted as a CSS value. If None, will be set to 640px.'}, 'visible': {'type': 'bool', 'default': 'True', 'description': 'If False, component will be hidden.'}, 'streaming': {'type': 'bool', 'default': 'False', 'description': 'If True, the data should be incrementally yielded from the source as `bytes` returned by calling `.read()` on an `rr.binary_stream()`'}, '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 list of strings that are assigned as the classes of this component in the HTML DOM. Can be used for targeting CSS styles.'}, 'render': {'type': 'bool', 'default': 'True', 'description': 'If False, component will not render be rendered in the Blocks context. Should be used if the intention is to assign event listeners now but render the component later.'}}, 'postprocess': {'value': {'type': 'list[pathlib.Path | str] | pathlib.Path | str | bytes', 'description': 'Expects'}}, 'preprocess': {'return': {'type': 'RerunData | None', 'description': 'A RerunData object.'}, 'value': None}}, 'events': {}}, '__meta__': {'additional_interfaces': {'RerunData': {'source': 'class RerunData(GradioRootModel):\n root: list[FileData | str]'}}, 'user_fn_refs': {'Rerun': ['RerunData']}}}
7
 
8
  abs_path = os.path.join(os.path.dirname(__file__), "css.css")
9
 
 
21
  # `gradio_rerun`
22
 
23
  <div style="display: flex; gap: 7px;">
24
+ <a href="https://pypi.org/project/gradio_rerun/" target="_blank"><img alt="PyPI - Version" src="https://img.shields.io/pypi/v/gradio_rerun"></a> <a href="https://github.com/radames/gradio-rerun-viewer/issues" target="_blank"><img alt="Static Badge" src="https://img.shields.io/badge/Issues-white?logo=github&logoColor=black"></a>
25
  </div>
26
 
27
  Rerun viewer with Gradio
 
38
  ## Usage
39
 
40
  ```python
41
+ import cv2
42
+ import os
43
+ import tempfile
44
+ import time
45
+
46
  import gradio as gr
47
  from gradio_rerun import Rerun
48
 
49
+ import rerun as rr
50
+ import rerun.blueprint as rrb
51
 
52
+ from color_grid import build_color_grid
53
 
54
+ # NOTE: Functions that work with Rerun should be decorated with `@rr.thread_local_stream`.
55
+ # This decorator creates a generator-aware thread-local context so that rerun log calls
56
+ # across multiple workers stay isolated.
57
 
 
 
 
 
58
 
59
+ # A task can directly log to a binary stream, which is routed to the embedded viewer.
60
+ # Incremental chunks are yielded to the viewer using `yield stream.read()`.
61
+ #
62
+ # This is the preferred way to work with Rerun in Gradio since your data can be immediately and
63
+ # incrementally seen by the viewer. Also, there are no ephemeral RRDs to cleanup or manage.
64
+ @rr.thread_local_stream("rerun_example_streaming_blur")
65
+ def streaming_repeated_blur(img):
66
+ stream = rr.binary_stream()
67
 
68
+ if img is None:
69
+ raise gr.Error("Must provide an image to blur.")
70
+
71
+ blueprint = rrb.Blueprint(
72
+ rrb.Horizontal(
73
+ rrb.Spatial2DView(origin="image/original"),
74
+ rrb.Spatial2DView(origin="image/blurred"),
75
+ ),
76
+ collapse_panels=True,
77
+ )
78
+
79
+ rr.send_blueprint(blueprint)
80
+
81
+ rr.set_time_sequence("iteration", 0)
82
+
83
+ rr.log("image/original", rr.Image(img))
84
+ yield stream.read()
85
+
86
+ blur = img
87
+
88
+ for i in range(100):
89
+ rr.set_time_sequence("iteration", i)
90
+
91
+ # Pretend blurring takes a while so we can see streaming in action.
92
+ time.sleep(0.1)
93
+ blur = cv2.GaussianBlur(blur, (5, 5), 0)
94
+
95
+ rr.log("image/blurred", rr.Image(blur))
96
+
97
+ # Each time we yield bytes from the stream back to Gradio, they
98
+ # are incrementally sent to the viewer. Make sure to yield any time
99
+ # you want the user to be able to see progress.
100
+ yield stream.read()
101
+
102
+
103
+ # However, if you have a workflow that creates an RRD file instead, you can still send it
104
+ # directly to the viewer by simply returning the path to the RRD file.
105
+ #
106
+ # This may be helpful if you need to execute a helper tool written in C++ or Rust that can't
107
+ # be easily modified to stream data directly via Gradio.
108
+ #
109
+ # In this case you may want to clean up the RRD file after it's sent to the viewer so that you
110
+ # don't accumulate too many temporary files.
111
+ @rr.thread_local_stream("rerun_example_cube_rrd")
112
+ def create_cube_rrd(x, y, z, pending_cleanup):
113
+ cube = build_color_grid(int(x), int(y), int(z), twist=0)
114
+ rr.log("cube", rr.Points3D(cube.positions, colors=cube.colors, radii=0.5))
115
+
116
+ # We eventually want to clean up the RRD file after it's sent to the viewer, so tracking
117
+ # any pending files to be cleaned up when the state is deleted.
118
+ temp = tempfile.NamedTemporaryFile(prefix="cube_", suffix=".rrd", delete=False)
119
+ pending_cleanup.append(temp.name)
120
+
121
+ blueprint = rrb.Spatial3DView(origin="cube")
122
+ rr.save(temp.name, default_blueprint=blueprint)
123
+
124
+ # Just return the name of the file -- Gradio will convert it to a FileData object
125
+ # and send it to the viewer.
126
+ return temp.name
127
+
128
+
129
+ def cleanup_cube_rrds(pending_cleanup):
130
+ for f in pending_cleanup:
131
+ os.unlink(f)
132
+
133
+
134
+ with gr.Blocks() as demo:
135
+ with gr.Tab("Streaming"):
136
+ with gr.Row():
137
+ img = gr.Image(interactive=True, label="Image")
138
+ with gr.Column():
139
+ stream_blur = gr.Button("Stream Repeated Blur")
140
+
141
+ with gr.Tab("Dynamic RRD"):
142
+ pending_cleanup = gr.State(
143
+ [], time_to_live=10, delete_callback=cleanup_cube_rrds
144
+ )
145
+ with gr.Row():
146
+ x_count = gr.Number(
147
+ minimum=1, maximum=10, value=5, precision=0, label="X Count"
148
+ )
149
+ y_count = gr.Number(
150
+ minimum=1, maximum=10, value=5, precision=0, label="Y Count"
151
+ )
152
+ z_count = gr.Number(
153
+ minimum=1, maximum=10, value=5, precision=0, label="Z Count"
154
+ )
155
+ with gr.Row():
156
+ create_rrd = gr.Button("Create RRD")
157
+
158
+ with gr.Tab("Hosted RRD"):
159
+ with gr.Row():
160
+ # It may be helpful to point the viewer to a hosted RRD file on another server.
161
+ # If an RRD file is hosted via http, you can just return a URL to the file.
162
+ choose_rrd = gr.Dropdown(
163
+ label="RRD",
164
+ choices=[
165
+ f"{rr.bindings.get_app_url()}/examples/arkit_scenes.rrd",
166
+ f"{rr.bindings.get_app_url()}/examples/dna.rrd",
167
+ f"{rr.bindings.get_app_url()}/examples/plots.rrd",
168
+ ],
169
+ )
170
+
171
+ # Rerun 0.16 has issues when embedded in a Gradio tab, so we share a viewer between all the tabs.
172
+ # In 0.17 we can instead scope each viewer to its own tab to clean up these examples further.
173
  with gr.Row():
174
+ viewer = Rerun(
175
+ streaming=True,
176
+ )
177
+
178
+ stream_blur.click(streaming_repeated_blur, inputs=[img], outputs=[viewer])
179
+
180
+ create_rrd.click(
181
+ create_cube_rrd,
182
+ inputs=[x_count, y_count, z_count, pending_cleanup],
183
+ outputs=[viewer],
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
184
  )
185
 
186
+ choose_rrd.change(lambda x: x, inputs=[choose_rrd], outputs=[viewer])
187
+
188
+
189
  if __name__ == "__main__":
190
  demo.launch()
191
 
 
199
  ### Initialization
200
  """, elem_classes=["md-custom"], header_links=True)
201
 
202
+ gr.ParamViewer(value=_docs["Rerun"]["members"]["__init__"], linkify=['RerunData'])
 
 
 
 
203
 
204
 
205
 
 
215
 
216
  The code snippet below is accurate in cases where the component is used as both an input and an output.
217
 
218
+ - **As input:** Is passed, a RerunData object.
219
+ - **As output:** Should return, expects.
220
 
221
  ```python
222
  def predict(
223
+ value: RerunData | None
224
+ ) -> list[pathlib.Path | str] | pathlib.Path | str | bytes:
 
 
 
225
  return value
226
  ```
227
  """, elem_classes=["md-custom", "Rerun-user-fn"], header_links=True)
 
229
 
230
 
231
 
232
+ code_RerunData = gr.Markdown("""
233
+ ## `RerunData`
234
+ ```python
235
+ class RerunData(GradioRootModel):
236
+ root: list[FileData | str]
237
+ ```""", elem_classes=["md-custom", "RerunData"], header_links=True)
238
+
239
  demo.load(None, js=r"""function() {
240
+ const refs = {
241
+ RerunData: [], };
242
  const user_fn_refs = {
243
+ Rerun: ['RerunData'], };
244
  requestAnimationFrame(() => {
245
 
246
  Object.entries(user_fn_refs).forEach(([key, refs]) => {
src/frontend/Index.svelte CHANGED
@@ -8,7 +8,7 @@
8
  import "./app.css";
9
  import type { Gradio } from "@gradio/utils";
10
 
11
- import { WebViewer } from "@rerun-io/web-viewer";
12
  import { onMount } from "svelte";
13
 
14
  import { Block } from "@gradio/atoms";
@@ -16,16 +16,24 @@
16
  import type { FileData } from "@gradio/client";
17
  import type { LoadingStatus } from "@gradio/statustracker";
18
 
 
 
 
 
 
19
  export let elem_id = "";
20
  export let elem_classes: string[] = [];
21
  export let visible = true;
22
  export let height: number | string = 640;
23
- export let value: null | FileData[] | string[] = null;
24
  export let container = true;
25
  export let scale: number | null = null;
26
  export let min_width: number | undefined = undefined;
27
  export let loading_status: LoadingStatus;
28
  export let interactive: boolean;
 
 
 
29
 
30
  export let gradio: Gradio<{
31
  change: never;
@@ -36,28 +44,60 @@
36
 
37
  $: height = typeof height === "number" ? `${height}px` : height;
38
 
39
- $: value, gradio.dispatch("change");
40
  let dragging: boolean;
41
  let rr: WebViewer;
42
  let ref: HTMLDivElement;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
43
 
44
  onMount(() => {
45
  rr = new WebViewer();
46
- rr.start(undefined, ref);
47
- return () => rr.stop();
 
 
 
 
 
48
  });
49
 
50
- $: if (value !== null && Array.isArray(value)) {
51
- for (const file of value) {
52
- if (typeof file !== "string") {
53
- if (file.url) {
54
- rr.open(file.url);
55
- }
56
- } else {
57
- rr.open(file);
58
- }
59
  }
60
  }
 
 
61
  </script>
62
 
63
  {#if !interactive}
@@ -76,20 +116,22 @@
76
  <StatusTracker
77
  autoscroll={gradio.autoscroll}
78
  i18n={gradio.i18n}
79
- {...loading_status}
80
  on:clear_status={() => gradio.dispatch("clear_status", loading_status)}
81
  />
82
  <div class="viewer" bind:this={ref} style:height />
83
  </Block>
84
  {/if}
85
 
86
- <style>
87
- .viewer {
88
  width: 100%;
89
- }
90
 
91
- :global(div.viewer > canvas) {
92
- position: initial !important;
93
- top: unset !important;
 
 
 
94
  }
95
  </style>
 
8
  import "./app.css";
9
  import type { Gradio } from "@gradio/utils";
10
 
11
+ import { WebViewer, LogChannel } from "@rerun-io/web-viewer";
12
  import { onMount } from "svelte";
13
 
14
  import { Block } from "@gradio/atoms";
 
16
  import type { FileData } from "@gradio/client";
17
  import type { LoadingStatus } from "@gradio/statustracker";
18
 
19
+ interface BinaryStream {
20
+ url: string;
21
+ is_stream: boolean;
22
+ }
23
+
24
  export let elem_id = "";
25
  export let elem_classes: string[] = [];
26
  export let visible = true;
27
  export let height: number | string = 640;
28
+ export let value: null | BinaryStream | (FileData | string)[] = null;
29
  export let container = true;
30
  export let scale: number | null = null;
31
  export let min_width: number | undefined = undefined;
32
  export let loading_status: LoadingStatus;
33
  export let interactive: boolean;
34
+ export let streaming: boolean;
35
+
36
+ let old_value: null | BinaryStream | (FileData | string)[] = null;
37
 
38
  export let gradio: Gradio<{
39
  change: never;
 
44
 
45
  $: height = typeof height === "number" ? `${height}px` : height;
46
 
 
47
  let dragging: boolean;
48
  let rr: WebViewer;
49
  let ref: HTMLDivElement;
50
+ let patched_loading_status: LoadingStatus;
51
+
52
+ function try_load_value() {
53
+ if (
54
+ JSON.stringify(value) !== JSON.stringify(old_value) &&
55
+ rr != undefined &&
56
+ rr.ready
57
+ ) {
58
+ old_value = value;
59
+ if (!Array.isArray(value)) {
60
+ if (value.is_stream) {
61
+ rr.open(value.url, { follow_if_http: true });
62
+ } else {
63
+ rr.open(value.url);
64
+ }
65
+ } else {
66
+ for (const file of value) {
67
+ if (typeof file !== "string") {
68
+ if (file.url) {
69
+ rr.open(file.url);
70
+ }
71
+ } else {
72
+ rr.open(file);
73
+ }
74
+ }
75
+ }
76
+ }
77
+ }
78
 
79
  onMount(() => {
80
  rr = new WebViewer();
81
+ rr.start(undefined, ref, true).then(() => {
82
+ try_load_value();
83
+ });
84
+
85
+ return () => {
86
+ rr.stop();
87
+ };
88
  });
89
 
90
+ $: {
91
+ patched_loading_status = loading_status;
92
+
93
+ // In streaming mode, we want the UI to be interactive even while the model is generating
94
+ // so set the status to complete.
95
+ if (streaming && patched_loading_status?.status === "generating") {
96
+ patched_loading_status.status = "complete";
 
 
97
  }
98
  }
99
+
100
+ $: value, try_load_value();
101
  </script>
102
 
103
  {#if !interactive}
 
116
  <StatusTracker
117
  autoscroll={gradio.autoscroll}
118
  i18n={gradio.i18n}
119
+ {...patched_loading_status}
120
  on:clear_status={() => gradio.dispatch("clear_status", loading_status)}
121
  />
122
  <div class="viewer" bind:this={ref} style:height />
123
  </Block>
124
  {/if}
125
 
126
+ <style lang="scss">
127
+ div.viewer {
128
  width: 100%;
 
129
 
130
+ :global(> canvas) {
131
+ position: initial !important;
132
+ top: unset !important;
133
+ width: 100%;
134
+ height: 100%;
135
+ }
136
  }
137
  </style>
src/frontend/package-lock.json CHANGED
@@ -16,7 +16,7 @@
16
  "@gradio/upload": "0.9.0",
17
  "@gradio/utils": "0.4.0",
18
  "@gradio/wasm": "0.10.0",
19
- "@rerun-io/web-viewer": "^0.15.1",
20
  "cropperjs": "^1.5.12",
21
  "lazy-brush": "^1.0.1",
22
  "resize-observer-polyfill": "^1.5.1",
@@ -28,6 +28,16 @@
28
  "tailwindcss": "^4.0.0-alpha.14"
29
  }
30
  },
 
 
 
 
 
 
 
 
 
 
31
  "node_modules/@adobe/css-tools": {
32
  "version": "4.3.3",
33
  "resolved": "https://registry.npmjs.org/@adobe/css-tools/-/css-tools-4.3.3.tgz",
@@ -694,9 +704,10 @@
694
  }
695
  },
696
  "node_modules/@rerun-io/web-viewer": {
697
- "version": "0.15.1",
698
- "resolved": "https://registry.npmjs.org/@rerun-io/web-viewer/-/web-viewer-0.15.1.tgz",
699
- "integrity": "sha512-rE4kZRVd+7FRSItOJkOjpp+a1swDGPQpYF0DY+dqmm1lIu9Ohq13MSKd3WlwKXk+88J/yxpdyxI/1vTRTQ4vjQ=="
 
700
  },
701
  "node_modules/@rollup/plugin-sucrase": {
702
  "version": "5.0.2",
 
16
  "@gradio/upload": "0.9.0",
17
  "@gradio/utils": "0.4.0",
18
  "@gradio/wasm": "0.10.0",
19
+ "@rerun-io/web-viewer": "^0.16.1",
20
  "cropperjs": "^1.5.12",
21
  "lazy-brush": "^1.0.1",
22
  "resize-observer-polyfill": "^1.5.1",
 
28
  "tailwindcss": "^4.0.0-alpha.14"
29
  }
30
  },
31
+ "../../rerun/rerun_js/web-viewer": {
32
+ "name": "@rerun-io/web-viewer",
33
+ "version": "0.16.0",
34
+ "extraneous": true,
35
+ "license": "MIT",
36
+ "devDependencies": {
37
+ "dts-buddy": "^0.3.0",
38
+ "typescript": "^5.2.2"
39
+ }
40
+ },
41
  "node_modules/@adobe/css-tools": {
42
  "version": "4.3.3",
43
  "resolved": "https://registry.npmjs.org/@adobe/css-tools/-/css-tools-4.3.3.tgz",
 
704
  }
705
  },
706
  "node_modules/@rerun-io/web-viewer": {
707
+ "version": "0.16.1",
708
+ "resolved": "https://registry.npmjs.org/@rerun-io/web-viewer/-/web-viewer-0.16.1.tgz",
709
+ "integrity": "sha512-S1Vd4ltHf+hTpZ/Z2BzbcHAljmTrx624pVm0o/fV8Af3Yf404kMW5Gjdt/WkLlA8z9jSwYN0B+o0dkoVQRKC4w==",
710
+ "license": "MIT"
711
  },
712
  "node_modules/@rollup/plugin-sucrase": {
713
  "version": "5.0.2",
src/frontend/package.json CHANGED
@@ -14,7 +14,7 @@
14
  "@gradio/upload": "0.9.0",
15
  "@gradio/utils": "0.4.0",
16
  "@gradio/wasm": "0.10.0",
17
- "@rerun-io/web-viewer": "^0.15.1",
18
  "cropperjs": "^1.5.12",
19
  "lazy-brush": "^1.0.1",
20
  "resize-observer-polyfill": "^1.5.1",
@@ -32,4 +32,4 @@
32
  "./example": "./Example.svelte",
33
  "./package.json": "./package.json"
34
  }
35
- }
 
14
  "@gradio/upload": "0.9.0",
15
  "@gradio/utils": "0.4.0",
16
  "@gradio/wasm": "0.10.0",
17
+ "@rerun-io/web-viewer": "^0.16.1",
18
  "cropperjs": "^1.5.12",
19
  "lazy-brush": "^1.0.1",
20
  "resize-observer-polyfill": "^1.5.1",
 
32
  "./example": "./Example.svelte",
33
  "./package.json": "./package.json"
34
  }
35
+ }
src/pyproject.toml CHANGED
@@ -8,15 +8,23 @@ build-backend = "hatchling.build"
8
 
9
  [project]
10
  name = "gradio_rerun"
11
- version = "0.0.1"
12
  description = "Rerun viewer with Gradio"
13
  readme = "README.md"
14
  license = "apache-2.0"
15
  requires-python = ">=3.8"
16
  authors = [{ name = "Radamés Ajna", email = "[email protected]" }]
17
- keywords = ["gradio-custom-component", "multimodal data", "visualization", "machine learning", "robotics", "Rerun", "rerun-viewer"]
 
 
 
 
 
 
 
 
18
  # Add dependencies here
19
- dependencies = ["gradio>=4.0,<5.0"]
20
  classifiers = [
21
  'Development Status :: 3 - Alpha',
22
  'Operating System :: OS Independent',
 
8
 
9
  [project]
10
  name = "gradio_rerun"
11
+ version = "0.0.3"
12
  description = "Rerun viewer with Gradio"
13
  readme = "README.md"
14
  license = "apache-2.0"
15
  requires-python = ">=3.8"
16
  authors = [{ name = "Radamés Ajna", email = "[email protected]" }]
17
+ keywords = [
18
+ "gradio-custom-component",
19
+ "multimodal data",
20
+ "visualization",
21
+ "machine learning",
22
+ "robotics",
23
+ "Rerun",
24
+ "rerun-viewer",
25
+ ]
26
  # Add dependencies here
27
+ dependencies = ["gradio>=4.0,<5.0", "rerun-sdk>=0.16.1"]
28
  classifiers = [
29
  'Development Status :: 3 - Alpha',
30
  'Operating System :: OS Independent',