Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
fix 3d model path
Browse files- check_paths.py +17 -0
- config.py +11 -6
- ui_components.py +7 -5
check_paths.py
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from config import SCENE_CONFIGS
|
| 2 |
+
import os
|
| 3 |
+
|
| 4 |
+
print('GLB文件路径检查:')
|
| 5 |
+
for scene, config in SCENE_CONFIGS.items():
|
| 6 |
+
glb_path = config.get('glb_path', '')
|
| 7 |
+
exists = os.path.exists(glb_path)
|
| 8 |
+
status = '存在' if exists else '不存在'
|
| 9 |
+
print(f'{scene}: {glb_path} - {status}')
|
| 10 |
+
|
| 11 |
+
print('\nEpisode图片路径检查 (以episode_1为例):')
|
| 12 |
+
for scene, config in SCENE_CONFIGS.items():
|
| 13 |
+
scene_name = config.get('scene_name', scene)
|
| 14 |
+
image_path = os.path.join('scene_assets', f'{scene_name}_0.jpg')
|
| 15 |
+
exists = os.path.exists(image_path)
|
| 16 |
+
status = '存在' if exists else '不存在'
|
| 17 |
+
print(f'{scene} -> {scene_name}: {image_path} - {status}')
|
config.py
CHANGED
|
@@ -14,35 +14,40 @@ SCENE_CONFIGS = {
|
|
| 14 |
"description": "Demo 1",
|
| 15 |
"objects": ["bedroom", "kitchen", "living room", ""],
|
| 16 |
"preview_image": "./assets/scene_1.png",
|
| 17 |
-
"glb_path": "scene_assets/
|
|
|
|
| 18 |
"default_instruction": "Walk past the left side of the bed and stop in the doorway."
|
| 19 |
},
|
| 20 |
"demo2": {
|
| 21 |
-
"description": "Demo 2",
|
| 22 |
"objects": ["office", "meeting room", "corridor"],
|
| 23 |
"preview_image": "./assets/scene_2.png",
|
| 24 |
-
"glb_path": "scene_assets/
|
|
|
|
| 25 |
"default_instruction": "Walk through the bathroom, past the sink and toilet. Stop in front of the counter with the two suitcase."
|
| 26 |
},
|
| 27 |
"demo3": {
|
| 28 |
"description": "Demo 3",
|
| 29 |
"objects": ["garage", "workshop", "storage"],
|
| 30 |
"preview_image": "./assets/scene_3.png",
|
| 31 |
-
"glb_path": "scene_assets/
|
|
|
|
| 32 |
"default_instruction": "Do a U-turn. Walk forward through the kitchen, heading to the black door. Walk out of the door and take a right onto the deck. Walk out on to the deck and stop."
|
| 33 |
},
|
| 34 |
"demo4": {
|
| 35 |
"description": "Demo 4",
|
| 36 |
"objects": ["garden", "patio", "pool"],
|
| 37 |
"preview_image": "./assets/scene_4.png",
|
| 38 |
-
"glb_path": "scene_assets/
|
|
|
|
| 39 |
"default_instruction": "Walk out of bathroom and stand on white bath mat."
|
| 40 |
},
|
| 41 |
"demo5": {
|
| 42 |
"description": "Demo 5",
|
| 43 |
"objects": ["library", "hall", "lounge"],
|
| 44 |
"preview_image": "./assets/scene_5.png",
|
| 45 |
-
"glb_path": "scene_assets/
|
|
|
|
| 46 |
"default_instruction": "Walk straight through the double wood doors, follow the red carpet straight to the next doorway and stop where the carpet splits off."
|
| 47 |
},
|
| 48 |
}
|
|
|
|
| 14 |
"description": "Demo 1",
|
| 15 |
"objects": ["bedroom", "kitchen", "living room", ""],
|
| 16 |
"preview_image": "./assets/scene_1.png",
|
| 17 |
+
"glb_path": "scene_assets/scene1_no_ceiling.glb",
|
| 18 |
+
"scene_name": "17DRP5sb8fy",
|
| 19 |
"default_instruction": "Walk past the left side of the bed and stop in the doorway."
|
| 20 |
},
|
| 21 |
"demo2": {
|
| 22 |
+
"description": "Demo 2",
|
| 23 |
"objects": ["office", "meeting room", "corridor"],
|
| 24 |
"preview_image": "./assets/scene_2.png",
|
| 25 |
+
"glb_path": "scene_assets/scene2_no_ceiling.glb",
|
| 26 |
+
"scene_name": "r1Q1Z4BcV1o",
|
| 27 |
"default_instruction": "Walk through the bathroom, past the sink and toilet. Stop in front of the counter with the two suitcase."
|
| 28 |
},
|
| 29 |
"demo3": {
|
| 30 |
"description": "Demo 3",
|
| 31 |
"objects": ["garage", "workshop", "storage"],
|
| 32 |
"preview_image": "./assets/scene_3.png",
|
| 33 |
+
"glb_path": "scene_assets/scene3_no_ceiling.glb",
|
| 34 |
+
"scene_name": "dhjEzFoUFzH",
|
| 35 |
"default_instruction": "Do a U-turn. Walk forward through the kitchen, heading to the black door. Walk out of the door and take a right onto the deck. Walk out on to the deck and stop."
|
| 36 |
},
|
| 37 |
"demo4": {
|
| 38 |
"description": "Demo 4",
|
| 39 |
"objects": ["garden", "patio", "pool"],
|
| 40 |
"preview_image": "./assets/scene_4.png",
|
| 41 |
+
"glb_path": "scene_assets/scene4_no_ceiling.glb",
|
| 42 |
+
"scene_name": "demo4", # 没有对应的图片文件,保持原名
|
| 43 |
"default_instruction": "Walk out of bathroom and stand on white bath mat."
|
| 44 |
},
|
| 45 |
"demo5": {
|
| 46 |
"description": "Demo 5",
|
| 47 |
"objects": ["library", "hall", "lounge"],
|
| 48 |
"preview_image": "./assets/scene_5.png",
|
| 49 |
+
"glb_path": "scene_assets/scene4_no_ceiling.glb", # 只有scene1-4的GLB文件
|
| 50 |
+
"scene_name": "demo5", # 没有对应的图片文件,保持原名
|
| 51 |
"default_instruction": "Walk straight through the double wood doors, follow the red carpet straight to the next doorway and stop where the carpet splits off."
|
| 52 |
},
|
| 53 |
}
|
ui_components.py
CHANGED
|
@@ -41,15 +41,17 @@ def update_scene_display(scene: str):
|
|
| 41 |
|
| 42 |
def update_episode_display(scene: str, episode: str):
|
| 43 |
config = SCENE_CONFIGS.get(scene, {})
|
| 44 |
-
scene_name = scene #
|
| 45 |
episode_id = int(episode[-1])
|
| 46 |
image_path = os.path.join("scene_assets", f"{scene_name}_{episode_id-1}.jpg")
|
| 47 |
|
| 48 |
# Validate if file path exists
|
| 49 |
-
if
|
| 50 |
-
return
|
| 51 |
-
|
| 52 |
-
|
|
|
|
|
|
|
| 53 |
|
| 54 |
def get_scene_instruction(scene: str):
|
| 55 |
"""根据场景获取默认指令"""
|
|
|
|
| 41 |
|
| 42 |
def update_episode_display(scene: str, episode: str):
|
| 43 |
config = SCENE_CONFIGS.get(scene, {})
|
| 44 |
+
scene_name = config.get("scene_name", scene) # 使用配置中的scene_name
|
| 45 |
episode_id = int(episode[-1])
|
| 46 |
image_path = os.path.join("scene_assets", f"{scene_name}_{episode_id-1}.jpg")
|
| 47 |
|
| 48 |
# Validate if file path exists
|
| 49 |
+
if os.path.exists(image_path):
|
| 50 |
+
return image_path
|
| 51 |
+
else:
|
| 52 |
+
# Fallback to preview_image if episode image doesn't exist
|
| 53 |
+
fallback_path = config.get("preview_image", None)
|
| 54 |
+
return fallback_path
|
| 55 |
|
| 56 |
def get_scene_instruction(scene: str):
|
| 57 |
"""根据场景获取默认指令"""
|