Skip to content

botcity.plugins.cloudvision.plugin.BotCloudVisionPlugin

__init__(self) special

Bot CloudVision Plugin.

credentials(self, credentials)

Google Cloud Vision JSON credential file path.

Parameters:

Name Type Description Default
credentials str

Path to the JSON file.

required

entries(self)

Get the list of entries after reading the file.

Each element contains a list of values in which are: text, x1, y1, x2, y2, x3, y3, x4, y4 and page.

Returns:

Type Description
List[List]

List of entries.

full_text(self)

Get the full text from the image.

Returns:

Type Description
str

The full text.

read(self, filepath, raise_on_error=False)

Read the file and set the entries list.

Parameters:

Name Type Description Default
filepath str

The file path for the image or PDF to be read.

required
raise_on_error bool

Whether or not to raise an exception if it fails.

False

Exceptions:

Type Description
ValueError

If file is not an image or PDF.

render_rate(self)

Render resolution rate.

Returns:

Type Description
int

resolution rate

reset_case(self)

Reset the configuration for upper/lower case.

set_render_rate(self, rate)

Set the render resolution rate.

Parameters:

Name Type Description Default
rate int

resolution rate

required

set_threshold(self, threshold)

Set the threshold level to be applied to the image before parsing.

Parameters:

Name Type Description Default
threshold int

Threshold value. Use None for no threshold.

required

threshold(self)

Threshold to be applied before parsing the image.

Returns:

Type Description
int

Threshold value. By default it is None which means no threshold.

to_lower_case(self)

Convert the text to lower case when processing the file.

to_upper_case(self)

Convert the text to upper case when processing the file.