Spaces:
Sleeping
Sleeping
Download test/test_thread.py from AutoFramingSoftware/afs-backend: direct link, hf CLI and curl.
- Browser
- Download file 650 Bytes
-
https://huggingface.co/spaces/AutoFramingSoftware/afs-backend/resolve/main/test/test_thread.py
- Command line
-
hf download hf://spaces/AutoFramingSoftware/afs-backend/test/test_thread.py
-
curl -L -o test_thread.py https://huggingface.co/spaces/AutoFramingSoftware/afs-backend/resolve/main/test/test_thread.py
650 Bytes
| from services.single_tracker import SingleTracker | |
| from concurrent.futures import ThreadPoolExecutor | |
| import cv2 | |
| import asyncio | |
| async def test(): | |
| tracker = SingleTracker() | |
| frame = cv2.imread("Model/Adi.jpg") | |
| if frame is None: | |
| print("Failed to load image") | |
| return | |
| executor = ThreadPoolExecutor(max_workers=4) | |
| def run_inference(): | |
| res = tracker.process_frame(frame) | |
| print("Tracker Output:", res) | |
| print("Running in executor...") | |
| await asyncio.get_event_loop().run_in_executor(executor, run_inference) | |
| print("Done") | |
| if __name__ == "__main__": | |
| asyncio.run(test()) | |