Spaces:
Running
Running
File size: 650 Bytes
c64a277 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | 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())
|