Spaces:
Runtime error
Runtime error
Update app.py
Browse files4 unmodified lines56789103 unmodified lines14151617181920212223242526272829303132333435363738394 unmodified linesimport torchimport jsonfrom ultralytics import YOLOprint(f"Is CUDA available: {torch.cuda.is_available()}")# print(f"CUDA device: {torch.cuda.get_device_name(torch.cuda.current_device())}")3 unmodified linesdetect_model = YOLO('yolov8m_2023-10-23_best.pt')def detect(image):results = detect_model(image, conf=0.1)try:results = results[0].boxes.xyxy[0].cpu().numpy()top = int(results[1])left = int(results[0])width = int(results[2] - results[0])height = int(results[3] - results[1])return {"top": top,"left": left,"width": width,"height": height}except:return {"top": 0,"left": 0,"width": 0,"height": 0}title = "🐢"4 unmodified lines5678910113 unmodified lines151617181920212223242526272829303132333435363738394041424344454 unmodified linesimport torchimport jsonfrom ultralytics import YOLOfrom datetime import datetimeprint(f"Is CUDA available: {torch.cuda.is_available()}")# print(f"CUDA device: {torch.cuda.get_device_name(torch.cuda.current_device())}")3 unmodified linesdetect_model = YOLO('yolov8m_2023-10-23_best.pt')def detect(image):results = detect_model(image, conf=0.1)# Get the current timecurrent_time = datetime.now()# Format the current time as a stringformatted_time = current_time.strftime("%Y-%m-%d %H:%M:%S")print(formatted_time)try:results = results[0].boxes.xyxy[0].cpu().numpy()top = int(results[1])left = int(results[0])width = int(results[2] - results[0])height = int(results[3] - results[1])return {"top": top,"left": left,"width": width,"height": height}except:return {"top": 0,"left": 0,"width": 0,"height": 0}title = "🐢"
app.py+26-20