import spaces import gradio as gr import cv2 import tempfile from ultralytics import YOLOv10 model = YOLOv10.from_pretrained(f'jameslahm/yolov10n') @spaces.GPU def yolov10_inference(image, conf_threshold): width, _ = image.size import time start = time.time() results = model.predict(source=image, imgsz=width, conf=conf_threshold) end = time.time() annotated_image = results[0].plot() print("time", end - start) return annotated_image[:, :, ::-1] css=""".my-group {max-width: 600px !important; max-height: 600 !important;} .my-column {display: flex !important; justify-content: center !important; align-items: center !important};""" with gr.Blocks(css=css) as app: gr.HTML( """