Spaces:
Running
on
Zero
Running
on
Zero
xiaoyuxi
commited on
Commit
·
cf6e100
1
Parent(s):
83a7481
backend
Browse files
app.py
CHANGED
|
@@ -533,6 +533,28 @@ def launch_viz(grid_size, vo_points, fps, original_image_state):
|
|
| 533 |
track_video_content = result.get("track_video_content", None)
|
| 534 |
track_video_filename = result.get("track_video_filename", "tracked_video.mp4")
|
| 535 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 536 |
# If we have base64 encoded video content, save it as a temporary file
|
| 537 |
if track_video_content:
|
| 538 |
try:
|
|
|
|
| 533 |
track_video_content = result.get("track_video_content", None)
|
| 534 |
track_video_filename = result.get("track_video_filename", "tracked_video.mp4")
|
| 535 |
|
| 536 |
+
# ✅ 关键修复:直接返回backend的HTML内容,不需要iframe包装
|
| 537 |
+
# Backend返回的viz_html已经是完整的HTML,包含了嵌入的base64数据
|
| 538 |
+
print(f"✅ Received HTML content from backend (length: {len(viz_html)})")
|
| 539 |
+
|
| 540 |
+
# 🔧 Debug: 检查HTML内容是否包含关键元素
|
| 541 |
+
if viz_html:
|
| 542 |
+
has_base64 = "window.embeddedBase64" in viz_html
|
| 543 |
+
has_canvas = "<canvas" in viz_html
|
| 544 |
+
has_script = "<script" in viz_html
|
| 545 |
+
print(f"🔧 HTML Analysis:")
|
| 546 |
+
print(f" - Contains base64 data: {has_base64}")
|
| 547 |
+
print(f" - Contains canvas element: {has_canvas}")
|
| 548 |
+
print(f" - Contains script tags: {has_script}")
|
| 549 |
+
print(f" - HTML preview: {viz_html[:200]}...")
|
| 550 |
+
|
| 551 |
+
if not has_base64:
|
| 552 |
+
print("⚠️ Warning: HTML doesn't contain embedded base64 data!")
|
| 553 |
+
if not has_canvas:
|
| 554 |
+
print("⚠️ Warning: HTML doesn't contain canvas element!")
|
| 555 |
+
else:
|
| 556 |
+
print("❌ Warning: Empty HTML content received from backend!")
|
| 557 |
+
|
| 558 |
# If we have base64 encoded video content, save it as a temporary file
|
| 559 |
if track_video_content:
|
| 560 |
try:
|