Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -10,6 +10,10 @@ from mesh_service.run_interface import (
|
|
| 10 |
extract_faces_for_gui # <-- NEW helper from updated run_interface
|
| 11 |
)
|
| 12 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
# -----------------------------------------
|
| 14 |
# Gmsh initialize only once
|
| 15 |
# -----------------------------------------
|
|
@@ -38,7 +42,8 @@ def on_step_upload(step_file):
|
|
| 38 |
labels = [f["label"] for f in faces]
|
| 39 |
|
| 40 |
faces_json = json.dumps(faces)
|
| 41 |
-
default = labels[0] if labels else None
|
|
|
|
| 42 |
|
| 43 |
return gr.update(choices=labels, value=default), faces_json
|
| 44 |
|
|
@@ -217,6 +222,7 @@ with gr.Blocks(title="Mesh Refinement Agent") as iface:
|
|
| 217 |
selected_face_label = gr.Dropdown(
|
| 218 |
label="Select Load Face (detected from STEP)",
|
| 219 |
choices=[],
|
|
|
|
| 220 |
interactive=True
|
| 221 |
)
|
| 222 |
|
|
@@ -225,12 +231,13 @@ with gr.Blocks(title="Mesh Refinement Agent") as iface:
|
|
| 225 |
)
|
| 226 |
|
| 227 |
examples_data = [
|
| 228 |
-
["
|
| 229 |
-
["
|
| 230 |
-
["
|
| 231 |
-
["
|
| 232 |
]
|
| 233 |
|
|
|
|
| 234 |
# Populate face dropdown upon STEP upload
|
| 235 |
step_file.change(
|
| 236 |
on_step_upload,
|
|
|
|
| 10 |
extract_faces_for_gui # <-- NEW helper from updated run_interface
|
| 11 |
)
|
| 12 |
|
| 13 |
+
# Absolute path to example files inside Docker container
|
| 14 |
+
EXAMPLE_DIR = os.path.join(os.path.dirname(__file__), "example_steps")
|
| 15 |
+
|
| 16 |
+
|
| 17 |
# -----------------------------------------
|
| 18 |
# Gmsh initialize only once
|
| 19 |
# -----------------------------------------
|
|
|
|
| 42 |
labels = [f["label"] for f in faces]
|
| 43 |
|
| 44 |
faces_json = json.dumps(faces)
|
| 45 |
+
#default = labels[0] if labels else None
|
| 46 |
+
default = None
|
| 47 |
|
| 48 |
return gr.update(choices=labels, value=default), faces_json
|
| 49 |
|
|
|
|
| 222 |
selected_face_label = gr.Dropdown(
|
| 223 |
label="Select Load Face (detected from STEP)",
|
| 224 |
choices=[],
|
| 225 |
+
value=None,
|
| 226 |
interactive=True
|
| 227 |
)
|
| 228 |
|
|
|
|
| 231 |
)
|
| 232 |
|
| 233 |
examples_data = [
|
| 234 |
+
[f"{EXAMPLE_DIR}/example1.step", "3", "bend_bottom", "positive", "high", None, "[]", "wireframe"],
|
| 235 |
+
[f"{EXAMPLE_DIR}/example2.step", "2", "tension", "negative", "medium", None, "[]", "highlight"],
|
| 236 |
+
[f"{EXAMPLE_DIR}/example3.step", "3", "bend_bottom", "positive", "high", None, "[]", "heatmap"],
|
| 237 |
+
[f"{EXAMPLE_DIR}/example4.step", "3.5", "tension", "negative", "medium", None, "[]", "wireframe"],
|
| 238 |
]
|
| 239 |
|
| 240 |
+
|
| 241 |
# Populate face dropdown upon STEP upload
|
| 242 |
step_file.change(
|
| 243 |
on_step_upload,
|