class GenerateEmbedding

Traits

SerializesModels
Queueable

Properties

Image $image

The image to generate an embedding of.

User $user

The user who initiated the job.

protected bool $deleteWhenMissingModels

Ignore this job if the image or user does not exist any more.

$tries

The number of times the job may be attempted.

Methods

__construct(Image $image, User $user)

Create a new instance.

void
handle()

Handle the job.

string
generateEmbedding(Image $image)

Generate the embedding.

string
getImageBufferForPyworker(string $path)

Get the byte string of the resized image for the Python worker.

string
sendPyworkerRequest(string $buffer)

Send the scaled-down PNG image to the Python worker and return the embedding npy file as binary blob.

Details

at line 57
__construct(Image $image, User $user)

Create a new instance.

Parameters

Image $image
User $user

at line 68
void handle()

Handle the job.

Return Value

void

at line 88
protected string generateEmbedding(Image $image)

Generate the embedding.

Parameters

Image $image

Return Value

string

at line 101
protected string getImageBufferForPyworker(string $path)

Get the byte string of the resized image for the Python worker.

Parameters

string $path

Return Value

string

at line 121
protected string sendPyworkerRequest(string $buffer)

Send the scaled-down PNG image to the Python worker and return the embedding npy file as binary blob.

Parameters

string $buffer

Return Value

string