Spaces:
Sleeping
Sleeping
modifying Slider values
Browse files
app.py
CHANGED
|
@@ -10,11 +10,11 @@ REPO_ID = "c1tr0n75/VoxelPathFinder"
|
|
| 10 |
# 1) Make sure torch is imported, then define device BEFORE using it anywhere
|
| 11 |
DEVICE = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
| 12 |
|
| 13 |
-
# 2) Download model code and weights from
|
| 14 |
PY_PATH = hf_hub_download(repo_id=REPO_ID, filename="pathfinding_nn.py")
|
| 15 |
CKPT_PATH = hf_hub_download(repo_id=REPO_ID, filename="training_outputs/final_model.pth")
|
| 16 |
|
| 17 |
-
# 3) Dynamically import
|
| 18 |
spec = importlib.util.spec_from_file_location("pathfinding_nn", PY_PATH)
|
| 19 |
mod = importlib.util.module_from_spec(spec)
|
| 20 |
spec.loader.exec_module(mod)
|
|
@@ -76,7 +76,7 @@ def infer_random(obstacle_prob=0.2, seed=None):
|
|
| 76 |
with gr.Blocks(title="Voxel Path Finder") as demo:
|
| 77 |
gr.Markdown("## 3D Voxel Path Finder — Inference")
|
| 78 |
with gr.Tab("Random environment"):
|
| 79 |
-
obstacle = gr.Slider(0.0,
|
| 80 |
seed = gr.Number(value=None, label="Seed (optional)")
|
| 81 |
btn = gr.Button("Run inference")
|
| 82 |
out = gr.JSON(label="Result")
|
|
|
|
| 10 |
# 1) Make sure torch is imported, then define device BEFORE using it anywhere
|
| 11 |
DEVICE = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
| 12 |
|
| 13 |
+
# 2) Download model code and weights from the model repo
|
| 14 |
PY_PATH = hf_hub_download(repo_id=REPO_ID, filename="pathfinding_nn.py")
|
| 15 |
CKPT_PATH = hf_hub_download(repo_id=REPO_ID, filename="training_outputs/final_model.pth")
|
| 16 |
|
| 17 |
+
# 3) Dynamically import the model definitions
|
| 18 |
spec = importlib.util.spec_from_file_location("pathfinding_nn", PY_PATH)
|
| 19 |
mod = importlib.util.module_from_spec(spec)
|
| 20 |
spec.loader.exec_module(mod)
|
|
|
|
| 76 |
with gr.Blocks(title="Voxel Path Finder") as demo:
|
| 77 |
gr.Markdown("## 3D Voxel Path Finder — Inference")
|
| 78 |
with gr.Tab("Random environment"):
|
| 79 |
+
obstacle = gr.Slider(0.0, 1.0, value=0.2, step=0.05, label="Obstacle probability")
|
| 80 |
seed = gr.Number(value=None, label="Seed (optional)")
|
| 81 |
btn = gr.Button("Run inference")
|
| 82 |
out = gr.JSON(label="Result")
|