Docs Ruff codeblocks reformat and fix (#12847)
Signed-off-by: Glenn Jocher <glenn.jocher@ultralytics.com>
This commit is contained in:
parent
be5cf7a033
commit
68031133fd
9 changed files with 167 additions and 178 deletions
|
|
@ -61,9 +61,9 @@ The VSCode compatible protocols for viewing images using the integrated terminal
|
|||
|
||||
# Run inference on an image
|
||||
results = model.predict(source="ultralytics/assets/bus.jpg")
|
||||
|
||||
|
||||
# Plot inference results
|
||||
plot = results[0].plot() #(1)!
|
||||
plot = results[0].plot() # (1)!
|
||||
```
|
||||
|
||||
1. See [plot method parameters](../modes/predict.md#plot-method-parameters) to see possible arguments to use.
|
||||
|
|
@ -73,9 +73,9 @@ The VSCode compatible protocols for viewing images using the integrated terminal
|
|||
```{ .py .annotate }
|
||||
# Results image as bytes
|
||||
im_bytes = cv.imencode(
|
||||
".png", #(1)!
|
||||
".png", # (1)!
|
||||
plot,
|
||||
)[1].tobytes() #(2)!
|
||||
)[1].tobytes() # (2)!
|
||||
|
||||
# Image bytes as a file-like object
|
||||
mem_file = io.BytesIO(im_bytes)
|
||||
|
|
@ -110,9 +110,8 @@ The VSCode compatible protocols for viewing images using the integrated terminal
|
|||
import io
|
||||
|
||||
import cv2 as cv
|
||||
|
||||
from ultralytics import YOLO
|
||||
from sixel import SixelWriter
|
||||
from ultralytics import YOLO
|
||||
|
||||
# Load a model
|
||||
model = YOLO("yolov8n.pt")
|
||||
|
|
@ -121,13 +120,13 @@ model = YOLO("yolov8n.pt")
|
|||
results = model.predict(source="ultralytics/assets/bus.jpg")
|
||||
|
||||
# Plot inference results
|
||||
plot = results[0].plot() #(3)!
|
||||
plot = results[0].plot() # (3)!
|
||||
|
||||
# Results image as bytes
|
||||
im_bytes = cv.imencode(
|
||||
".png", #(1)!
|
||||
".png", # (1)!
|
||||
plot,
|
||||
)[1].tobytes() #(2)!
|
||||
)[1].tobytes() # (2)!
|
||||
|
||||
mem_file = io.BytesIO(im_bytes)
|
||||
w = SixelWriter()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue