Spaces:
Running
on
Zero
Running
on
Zero
xiaoyuxi
commited on
Commit
·
94f2349
1
Parent(s):
5347dd7
vggt
Browse files
app.py
CHANGED
|
@@ -100,9 +100,10 @@ def handle_video_upload(video):
|
|
| 100 |
if BACKEND_AVAILABLE and backend_api and hasattr(backend_api, 'fns'):
|
| 101 |
# Try to use backend API
|
| 102 |
try:
|
| 103 |
-
# Use the Blocks fns
|
| 104 |
-
if
|
| 105 |
-
|
|
|
|
| 106 |
# Parse the result to extract what we need
|
| 107 |
if isinstance(result, dict) and result.get("success"):
|
| 108 |
# For now, just extract the first frame locally
|
|
@@ -114,7 +115,7 @@ def handle_video_upload(video):
|
|
| 114 |
# Fallback to local processing
|
| 115 |
pass
|
| 116 |
else:
|
| 117 |
-
print("
|
| 118 |
# Fallback to local processing
|
| 119 |
pass
|
| 120 |
except Exception as e:
|
|
@@ -240,10 +241,11 @@ def launch_viz(grid_size, vo_points, fps, original_image_state):
|
|
| 240 |
print(f"🔧 Original image state type: {type(original_image_state)}")
|
| 241 |
print(f"🔧 Original image state preview: {str(original_image_state)[:100]}...")
|
| 242 |
|
| 243 |
-
# Use the Blocks fns
|
| 244 |
-
if
|
|
|
|
| 245 |
# For now, we'll use empty points since we're in local mode
|
| 246 |
-
result = backend_api.fns[
|
| 247 |
None, [], grid_size, vo_points, fps
|
| 248 |
)
|
| 249 |
|
|
@@ -261,7 +263,7 @@ def launch_viz(grid_size, vo_points, fps, original_image_state):
|
|
| 261 |
# Fallback to error message
|
| 262 |
pass
|
| 263 |
else:
|
| 264 |
-
print("
|
| 265 |
# Fallback to error message
|
| 266 |
pass
|
| 267 |
except Exception as e:
|
|
@@ -329,12 +331,13 @@ def test_backend_connection():
|
|
| 329 |
try:
|
| 330 |
# Try a simple API call to test connection
|
| 331 |
print("Testing backend connection with a simple call...")
|
| 332 |
-
#
|
| 333 |
-
if hasattr(backend_api, '
|
| 334 |
-
print("✅ Backend API
|
|
|
|
| 335 |
return True
|
| 336 |
else:
|
| 337 |
-
print("❌ Backend API
|
| 338 |
BACKEND_AVAILABLE = False
|
| 339 |
return False
|
| 340 |
except Exception as e:
|
|
@@ -351,13 +354,13 @@ def test_backend_api():
|
|
| 351 |
try:
|
| 352 |
print("🧪 Testing backend API functions...")
|
| 353 |
|
| 354 |
-
# Test if
|
| 355 |
-
|
| 356 |
-
|
| 357 |
-
|
| 358 |
-
print(f"✅ {
|
| 359 |
-
|
| 360 |
-
|
| 361 |
|
| 362 |
return True
|
| 363 |
except Exception as e:
|
|
|
|
| 100 |
if BACKEND_AVAILABLE and backend_api and hasattr(backend_api, 'fns'):
|
| 101 |
# Try to use backend API
|
| 102 |
try:
|
| 103 |
+
# Use the Blocks fns with numeric index (0 is usually the main function)
|
| 104 |
+
if 0 in backend_api.fns:
|
| 105 |
+
print("🔧 Calling backend function 0 (main processing function)")
|
| 106 |
+
result = backend_api.fns[0](video, [], 50, 756, 3)
|
| 107 |
# Parse the result to extract what we need
|
| 108 |
if isinstance(result, dict) and result.get("success"):
|
| 109 |
# For now, just extract the first frame locally
|
|
|
|
| 115 |
# Fallback to local processing
|
| 116 |
pass
|
| 117 |
else:
|
| 118 |
+
print("Backend function 0 not found")
|
| 119 |
# Fallback to local processing
|
| 120 |
pass
|
| 121 |
except Exception as e:
|
|
|
|
| 241 |
print(f"🔧 Original image state type: {type(original_image_state)}")
|
| 242 |
print(f"🔧 Original image state preview: {str(original_image_state)[:100]}...")
|
| 243 |
|
| 244 |
+
# Use the Blocks fns with numeric index (0 is usually the main function)
|
| 245 |
+
if 0 in backend_api.fns:
|
| 246 |
+
print("🔧 Calling backend function 0 (main processing function)")
|
| 247 |
# For now, we'll use empty points since we're in local mode
|
| 248 |
+
result = backend_api.fns[0](
|
| 249 |
None, [], grid_size, vo_points, fps
|
| 250 |
)
|
| 251 |
|
|
|
|
| 263 |
# Fallback to error message
|
| 264 |
pass
|
| 265 |
else:
|
| 266 |
+
print("Backend function 0 not found")
|
| 267 |
# Fallback to error message
|
| 268 |
pass
|
| 269 |
except Exception as e:
|
|
|
|
| 331 |
try:
|
| 332 |
# Try a simple API call to test connection
|
| 333 |
print("Testing backend connection with a simple call...")
|
| 334 |
+
# Check if we have fns available
|
| 335 |
+
if hasattr(backend_api, 'fns') and backend_api.fns:
|
| 336 |
+
print("✅ Backend API functions are available")
|
| 337 |
+
print(f"🔧 Available function indices: {list(backend_api.fns.keys())}")
|
| 338 |
return True
|
| 339 |
else:
|
| 340 |
+
print("❌ Backend API functions not found")
|
| 341 |
BACKEND_AVAILABLE = False
|
| 342 |
return False
|
| 343 |
except Exception as e:
|
|
|
|
| 354 |
try:
|
| 355 |
print("🧪 Testing backend API functions...")
|
| 356 |
|
| 357 |
+
# Test if fns exist and show available indices
|
| 358 |
+
if hasattr(backend_api, 'fns') and backend_api.fns:
|
| 359 |
+
print(f"✅ Backend has {len(backend_api.fns)} functions available")
|
| 360 |
+
for idx in backend_api.fns.keys():
|
| 361 |
+
print(f"✅ Function {idx} is available")
|
| 362 |
+
else:
|
| 363 |
+
print("❌ No functions available in backend")
|
| 364 |
|
| 365 |
return True
|
| 366 |
except Exception as e:
|