Page 1 of 1

Wie kann ich meinen eigenen Textract -Adapter mit PHP verwenden?

Posted: 22 Mar 2025, 04:53
by Anonymous
Ich habe versucht, meinen eigenen Textract -Adapter zu verwenden, aber es funktioniert nicht problemlos.public function analyzeDocumentWithAdapter($imageBytes, $queries, $adapterId)
{
// dd('Enviando solicitud a Textract con AdapterId:', ['AdapterId' => $adapterId]);

$result = $this->textract->analyzeDocument([
'Document' => [
'Bytes' => $imageBytes,
],
'FeatureTypes' => ['QUERIES'],
'QueriesConfig' => [
'Queries' => [
['Text' => 'What is the first name on the dpi?', 'Alias' => 'first_name'],
['Text' => 'What is the first last name on the dpi?', 'Alias' => 'first_last_name'],
['Text' => 'What is the second name on the dpi?', 'Alias' => 'second_name'],
['Text' => 'What is the date of birth?', 'Alias' => 'birth_date'],
['Text' => 'What is the second last name on the dpi?', 'Alias' => 'second_last_name'],
['Text' => 'What is the married last name?', 'Alias' => 'married_last_name'],
['Text' => 'What is the cui?', 'Alias' => 'cui'],
]
],
'AdapterConfig' => [
'Adapters' => [
'AdapterId' => $adapterId, // ID del adaptador entrenado,
'AdapterVersion' => '5',
]

],
]);

return $result['Blocks'] ?? [];
}
< /code>
Ich habe meinen geschulten Adapter gebunden. Es soll mit Fotos verwendet werden, die ich in einer Eingabedatei in HTML hochgeladen habe. Und ich möchte es benutzen.