Spaces:
Running
on
Zero
Running
on
Zero
xiaoyuxi
commited on
Commit
·
4d172be
1
Parent(s):
f02374d
vggt
Browse files
app.py
CHANGED
|
@@ -117,9 +117,10 @@ def handle_video_upload(video):
|
|
| 117 |
try:
|
| 118 |
print("🔧 Calling backend API for video upload...")
|
| 119 |
|
| 120 |
-
# Use call_function method
|
| 121 |
if 0 in backend_api.fns:
|
| 122 |
-
print("🔧 Using backend call_function method")
|
|
|
|
| 123 |
result = backend_api.call_function(0, [video, [], 50, 756, 3])
|
| 124 |
|
| 125 |
print(f"✅ Backend video upload API call successful!")
|
|
@@ -174,25 +175,28 @@ def select_point(original_img: str, sel_pix: list, point_type: str, evt: gr.Sele
|
|
| 174 |
try:
|
| 175 |
print(f"🔧 Calling backend select point API: x={evt.index[0]}, y={evt.index[1]}, type={point_type}")
|
| 176 |
|
| 177 |
-
# Use call_function method
|
| 178 |
-
if
|
| 179 |
-
print("🔧 Using backend call_function method for point selection")
|
| 180 |
-
|
|
|
|
|
|
|
|
|
|
| 181 |
|
| 182 |
print(f"✅ Backend select point API call successful!")
|
| 183 |
print(f"🔧 Result type: {type(result)}")
|
| 184 |
|
| 185 |
-
# Parse the result - expect
|
| 186 |
-
if isinstance(result,
|
| 187 |
-
|
| 188 |
-
|
| 189 |
-
|
| 190 |
else:
|
| 191 |
-
print("Backend
|
| 192 |
# Fallback to local processing
|
| 193 |
pass
|
| 194 |
else:
|
| 195 |
-
print("Backend function
|
| 196 |
# Fallback to local processing
|
| 197 |
pass
|
| 198 |
except Exception as e:
|
|
@@ -260,25 +264,26 @@ def reset_points(original_img: str, sel_pix):
|
|
| 260 |
try:
|
| 261 |
print("🔧 Calling backend reset points API")
|
| 262 |
|
| 263 |
-
# Use call_function method
|
| 264 |
-
if
|
| 265 |
-
print("🔧 Using backend call_function method for reset")
|
| 266 |
-
|
|
|
|
| 267 |
|
| 268 |
print(f"✅ Backend reset points API call successful!")
|
| 269 |
print(f"🔧 Result type: {type(result)}")
|
| 270 |
|
| 271 |
-
# Parse the result - expect
|
| 272 |
-
if isinstance(result,
|
| 273 |
-
|
| 274 |
-
|
| 275 |
-
|
| 276 |
else:
|
| 277 |
-
print("Backend
|
| 278 |
# Fallback to local processing
|
| 279 |
pass
|
| 280 |
else:
|
| 281 |
-
print("Backend function
|
| 282 |
# Fallback to local processing
|
| 283 |
pass
|
| 284 |
except Exception as e:
|
|
@@ -320,10 +325,10 @@ def launch_viz(grid_size, vo_points, fps, original_image_state):
|
|
| 320 |
print(f"🔧 Original image state type: {type(original_image_state)}")
|
| 321 |
print(f"🔧 Original image state preview: {str(original_image_state)[:100]}...")
|
| 322 |
|
| 323 |
-
# Use call_function method
|
| 324 |
if 0 in backend_api.fns:
|
| 325 |
-
print("🔧 Using backend call_function method")
|
| 326 |
-
#
|
| 327 |
result = backend_api.call_function(0, [None, [], grid_size, vo_points, fps])
|
| 328 |
|
| 329 |
print(f"✅ Backend API call successful!")
|
|
|
|
| 117 |
try:
|
| 118 |
print("🔧 Calling backend API for video upload...")
|
| 119 |
|
| 120 |
+
# Use call_function method - function 0 is the main processing function
|
| 121 |
if 0 in backend_api.fns:
|
| 122 |
+
print("🔧 Using backend call_function method (main processing)")
|
| 123 |
+
# Call the main processing function with video and empty points
|
| 124 |
result = backend_api.call_function(0, [video, [], 50, 756, 3])
|
| 125 |
|
| 126 |
print(f"✅ Backend video upload API call successful!")
|
|
|
|
| 175 |
try:
|
| 176 |
print(f"🔧 Calling backend select point API: x={evt.index[0]}, y={evt.index[1]}, type={point_type}")
|
| 177 |
|
| 178 |
+
# Use call_function method - function 0 is the main processing function
|
| 179 |
+
if 0 in backend_api.fns:
|
| 180 |
+
print("🔧 Using backend call_function method (main processing for point selection)")
|
| 181 |
+
# Create points list with the new point
|
| 182 |
+
points = [(evt.index[0], evt.index[1], point_type)]
|
| 183 |
+
# Call the main processing function with video and points
|
| 184 |
+
result = backend_api.call_function(0, [None, points, 50, 756, 3])
|
| 185 |
|
| 186 |
print(f"✅ Backend select point API call successful!")
|
| 187 |
print(f"🔧 Result type: {type(result)}")
|
| 188 |
|
| 189 |
+
# Parse the result - expect a dict with success status
|
| 190 |
+
if isinstance(result, dict) and result.get("success"):
|
| 191 |
+
# For now, use local processing for visualization
|
| 192 |
+
# Fallback to local processing
|
| 193 |
+
pass
|
| 194 |
else:
|
| 195 |
+
print("Backend processing failed, using local fallback")
|
| 196 |
# Fallback to local processing
|
| 197 |
pass
|
| 198 |
else:
|
| 199 |
+
print("Backend function 0 not found")
|
| 200 |
# Fallback to local processing
|
| 201 |
pass
|
| 202 |
except Exception as e:
|
|
|
|
| 264 |
try:
|
| 265 |
print("🔧 Calling backend reset points API")
|
| 266 |
|
| 267 |
+
# Use call_function method - function 0 is the main processing function
|
| 268 |
+
if 0 in backend_api.fns:
|
| 269 |
+
print("🔧 Using backend call_function method (main processing for reset)")
|
| 270 |
+
# Call the main processing function with video and empty points
|
| 271 |
+
result = backend_api.call_function(0, [None, [], 50, 756, 3])
|
| 272 |
|
| 273 |
print(f"✅ Backend reset points API call successful!")
|
| 274 |
print(f"🔧 Result type: {type(result)}")
|
| 275 |
|
| 276 |
+
# Parse the result - expect a dict with success status
|
| 277 |
+
if isinstance(result, dict) and result.get("success"):
|
| 278 |
+
# For now, use local processing for visualization
|
| 279 |
+
# Fallback to local processing
|
| 280 |
+
pass
|
| 281 |
else:
|
| 282 |
+
print("Backend processing failed, using local fallback")
|
| 283 |
# Fallback to local processing
|
| 284 |
pass
|
| 285 |
else:
|
| 286 |
+
print("Backend function 0 not found")
|
| 287 |
# Fallback to local processing
|
| 288 |
pass
|
| 289 |
except Exception as e:
|
|
|
|
| 325 |
print(f"🔧 Original image state type: {type(original_image_state)}")
|
| 326 |
print(f"🔧 Original image state preview: {str(original_image_state)[:100]}...")
|
| 327 |
|
| 328 |
+
# Use call_function method - function 0 is the main processing function
|
| 329 |
if 0 in backend_api.fns:
|
| 330 |
+
print("🔧 Using backend call_function method (main processing)")
|
| 331 |
+
# Call the main processing function with video and empty points
|
| 332 |
result = backend_api.call_function(0, [None, [], grid_size, vo_points, fps])
|
| 333 |
|
| 334 |
print(f"✅ Backend API call successful!")
|