Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -187,6 +187,8 @@ def process_video_with_points(video_path, click_points, tracker):
|
|
| 187 |
return output_path
|
| 188 |
|
| 189 |
# -------------------- Model Initialization -------------------- #
|
|
|
|
|
|
|
| 190 |
def load_model():
|
| 191 |
"""Initialize and load the tracking model."""
|
| 192 |
# Adjust these paths as needed.
|
|
@@ -215,6 +217,8 @@ def load_model():
|
|
| 215 |
|
| 216 |
return model
|
| 217 |
|
|
|
|
|
|
|
| 218 |
def create_tracker(model):
|
| 219 |
"""Create tracker instance with the loaded model."""
|
| 220 |
return Tracker(
|
|
@@ -251,6 +255,8 @@ def process_with_config(video_path, click_points, resolution, window_index, trac
|
|
| 251 |
tracker.S = mapping.get(int(window_index), 16)
|
| 252 |
return process_video_with_points(video_path, click_points, tracker)
|
| 253 |
|
|
|
|
|
|
|
| 254 |
def main():
|
| 255 |
"""Main function that initializes the model and runs the Gradio interface."""
|
| 256 |
# Set torch matmul precision
|
|
|
|
| 187 |
return output_path
|
| 188 |
|
| 189 |
# -------------------- Model Initialization -------------------- #
|
| 190 |
+
@torch.no_grad()
|
| 191 |
+
@spaces.GPU
|
| 192 |
def load_model():
|
| 193 |
"""Initialize and load the tracking model."""
|
| 194 |
# Adjust these paths as needed.
|
|
|
|
| 217 |
|
| 218 |
return model
|
| 219 |
|
| 220 |
+
@torch.no_grad()
|
| 221 |
+
@spaces.GPU
|
| 222 |
def create_tracker(model):
|
| 223 |
"""Create tracker instance with the loaded model."""
|
| 224 |
return Tracker(
|
|
|
|
| 255 |
tracker.S = mapping.get(int(window_index), 16)
|
| 256 |
return process_video_with_points(video_path, click_points, tracker)
|
| 257 |
|
| 258 |
+
@torch.no_grad()
|
| 259 |
+
@spaces.GPU
|
| 260 |
def main():
|
| 261 |
"""Main function that initializes the model and runs the Gradio interface."""
|
| 262 |
# Set torch matmul precision
|