> ## Documentation Index
> Fetch the complete documentation index at: https://docs.generalrobotics.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# MGP-STR 

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

<ResponseField name="class MGPSTR()">
  <ResponseField name="use_local" type="boolean" default="False">
    If True, inference call is run on the local VM, else offloaded onto GRID-Cortex. Defaults to True.
  </ResponseField>
</ResponseField>

<ResponseField name="def run()">
  <ResponseField name="rgbimage" type="np.ndarray" required="True">
    The input RGB image of shape $(M,N,3)$.
  </ResponseField>

  <ResponseField name="Returns" type="string">
    Recognized text from the image.
  </ResponseField>
</ResponseField>

<RequestExample>
  ```python Inference Call theme={null}
  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)
  ```
</RequestExample>

<Tabs>
  <Tab title="License">
    This code is licensed under the Apache 2.0 License.
  </Tab>

  <Tab title="Source">
    [https://huggingface.co/alibaba-damo/mgp-str-base](https://huggingface.co/alibaba-damo/mgp-str-base)
  </Tab>
</Tabs>
