Spaces:
Running
Running
Commit ·
0359819
1
Parent(s): 054c9d4
Fix G-Code upload spinner by keeping file widget always mounted
Browse files
app.py
CHANGED
|
@@ -330,7 +330,7 @@ GCODE_SOURCE_UPLOAD = "Upload G-Code file"
|
|
| 330 |
|
| 331 |
|
| 332 |
def toggle_gcode_source(source: str) -> dict[str, Any]:
|
| 333 |
-
return gr.update(
|
| 334 |
|
| 335 |
|
| 336 |
def render_toolpath(
|
|
@@ -666,7 +666,7 @@ def build_demo() -> gr.Blocks:
|
|
| 666 |
gcode_upload = gr.File(
|
| 667 |
label="Upload G-Code",
|
| 668 |
file_types=[".txt", ".gcode", ".nc"],
|
| 669 |
-
|
| 670 |
)
|
| 671 |
render_button = gr.Button("Render Tool Path", variant="primary")
|
| 672 |
toolpath_plot = gr.Plot(label="Tool Path")
|
|
@@ -676,6 +676,7 @@ def build_demo() -> gr.Blocks:
|
|
| 676 |
fn=toggle_gcode_source,
|
| 677 |
inputs=[gcode_source],
|
| 678 |
outputs=[gcode_upload],
|
|
|
|
| 679 |
)
|
| 680 |
render_button.click(
|
| 681 |
fn=render_toolpath,
|
|
|
|
| 330 |
|
| 331 |
|
| 332 |
def toggle_gcode_source(source: str) -> dict[str, Any]:
|
| 333 |
+
return gr.update(interactive=(source == GCODE_SOURCE_UPLOAD))
|
| 334 |
|
| 335 |
|
| 336 |
def render_toolpath(
|
|
|
|
| 666 |
gcode_upload = gr.File(
|
| 667 |
label="Upload G-Code",
|
| 668 |
file_types=[".txt", ".gcode", ".nc"],
|
| 669 |
+
interactive=False,
|
| 670 |
)
|
| 671 |
render_button = gr.Button("Render Tool Path", variant="primary")
|
| 672 |
toolpath_plot = gr.Plot(label="Tool Path")
|
|
|
|
| 676 |
fn=toggle_gcode_source,
|
| 677 |
inputs=[gcode_source],
|
| 678 |
outputs=[gcode_upload],
|
| 679 |
+
queue=False,
|
| 680 |
)
|
| 681 |
render_button.click(
|
| 682 |
fn=render_toolpath,
|