Upload pictures for pet feature analysis

Function Introduction

Upload the image to the server, send the returned values to the cloud for pet feature analysis.

Interaction Process

  1. Use chooseImage to select an image from your phone;
  2. Request a file upload signature and the corresponding objectKey from the cloud;
  3. Upload the image to the specified server;
  4. Pass the objectKey returned in step 2 as a parameter to the feature analysis interface, which will return a taskId. Then, poll the feature analysis result interface to check the progress.
    • If the returned analysisResult value is 2, it indicates that the analysis was successful;
    • If the value is 1, it indicates that the analysis failed. Display the corresponding analysis information based on the returned result.
sequenceDiagram
 rect rgb(191, 223, 255)
note right of Miniapps: Select mobile picture
    Miniapps->>Cloud: Obtain the file upload signature
    Cloud->>Miniapps: Return the file upload signature and objectKey
    Miniapps->>Cloud: Upload the image to the server
    Miniapps->>Cloud: Pass the cloudKey to the cloud
    Cloud->>Miniapps: Return the task ID
    Miniapps->>Cloud: Polling the feature analysis result interface to query task status
    Cloud->>Miniapps: Return feature analysis results
end