xinjie.wang
commited on
Commit
·
2a5c433
1
Parent(s):
9b4a1c9
Add application file
Browse files
app.py
CHANGED
@@ -17,30 +17,30 @@ with gr.Blocks() as demo:
|
|
17 |
clear_color=(0.9, 0.9, 0.9, 1) # 先设置亮色背景提升基础亮度
|
18 |
)
|
19 |
|
20 |
-
demo.load(
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
)
|
44 |
|
45 |
|
46 |
if __name__ == "__main__":
|
|
|
17 |
clear_color=(0.9, 0.9, 0.9, 1) # 先设置亮色背景提升基础亮度
|
18 |
)
|
19 |
|
20 |
+
# demo.load(
|
21 |
+
# js="""
|
22 |
+
# () => {
|
23 |
+
# // 等待组件加载完成(避免选择器找不到元素)
|
24 |
+
# const observer = new MutationObserver(() => {
|
25 |
+
# const viewer = document.querySelector('[data-testid="model3d-component"] .model-viewer');
|
26 |
+
# if (viewer) {
|
27 |
+
# const scene = viewer.modelView.scene;
|
28 |
+
# observer.disconnect(); // 找到后停止观察
|
29 |
|
30 |
+
# // 添加环境光(白色,强度 1.5)
|
31 |
+
# const ambientLight = new THREE.AmbientLight(0xffffff, 1.5);
|
32 |
+
# scene.add(ambientLight);
|
33 |
|
34 |
+
# // 添加方向光(从右上方照射,模拟自然光)
|
35 |
+
# const directionalLight = new THREE.DirectionalLight(0xffffff, 1.8);
|
36 |
+
# directionalLight.position.set(8, 10, 5); // 调整光源位置
|
37 |
+
# scene.add(directionalLight);
|
38 |
+
# }
|
39 |
+
# });
|
40 |
+
# observer.observe(document.body, { childList: true, subtree: true });
|
41 |
+
# }
|
42 |
+
# """
|
43 |
+
# )
|
44 |
|
45 |
|
46 |
if __name__ == "__main__":
|