Skip to content

Support for Textract async uploads #4913

@meketadev

Description

@meketadev

Describe the bug
After installing the predictions plugin to identify text for documents, and uploading a PDF, an error occurs: "Error: Unsupported document format".

To Reproduce
With a new ionic project
ionic start blank (add main and polyfill code)
amplify init
amplify add auth (defaults)
amplify add predictions -> identify -> Identify Text -> "Would you also like to identify documents?" Yes -> Auth and Guest users

try to identify a pdf
see error

import { Component } from '@angular/core';
import Predictions from '@aws-amplify/predictions';

@Component({
  selector: 'app-home',
  templateUrl: 'home.page.html',
  styleUrls: ['home.page.scss'],
})
export class HomePage {

  constructor() {}
  
  onFileChange(event) {
    const file = event.target.files[0];
    console.log(file)
    Predictions.identify({
      text: {
        source: {
          file
        },
        format: "ALL"
      }
    }).then(event => {
      console.log(event)
    })
  }

  
}

Expected behavior
Textract has an async function (start_document_analysis) for dealing with pdfs. I do not believe the current implementation allows for this. However, the "Would you also like to identify documents?" option seems like a question to allow for this.

Additional context
I'm not sure if this is creating a lambda function to handle the function. I can't seems to find the resource to switch to the async function.

Metadata

Metadata

Assignees

No one assigned

    Labels

    PredictionsRelated to Predictions categoryfeature-requestRequest a new feature

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions