from grid.model.perception.str.mgp_str import MGPSTR
car = AirGenCar()

# We will be capturing an image from the AirGen simulator 
# and run model inference on it.

img =  car.getImage("front_center", "rgb").data

model = MGPSTR(use_local = True)
result = model.run(rgbimage=img, prompt=<prompt>)
print(result)

The MGPSTR class implements a wrapper for the MGPSTR (Multi-Granularity Prediction for Scene Text Recognition) model, which recognizes text in images.

class MGPSTR()
use_local
boolean
default:"False"

If True, inference call is run on the local VM, else offloaded onto GRID-Cortex. Defaults to True.

This model is currently not available via Cortex.

def run()
rgbimage
np.ndarray
required

The input RGB image of shape (M,N,3)(M,N,3).

Returns
string

Recognized text from the image.

from grid.model.perception.str.mgp_str import MGPSTR
car = AirGenCar()

# We will be capturing an image from the AirGen simulator 
# and run model inference on it.

img =  car.getImage("front_center", "rgb").data

model = MGPSTR(use_local = True)
result = model.run(rgbimage=img, prompt=<prompt>)
print(result)
This model is best suited for recognizing text in images (OCR).

This code is licensed under the Apache 2.0 License.