Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement API endpoint for image alignment #364

Merged
merged 6 commits into from
Nov 6, 2024
Merged

Conversation

jonchang
Copy link
Collaborator

@jonchang jonchang commented Oct 31, 2024

Description

Implements an API endpoint for the image alignment backend so frontend code can access image alignment features.

Screenshots (if applicable)

Related Issues

#350

Checklist

  • The title of this PR is descriptive and concise.
  • My changes follow the style guidelines of this project.
  • I have added or updated test cases to cover my changes.
  • I've let the team know about this PR by linking it in the review channel

Testing notes

Since we still aren't sure about front end work, I tested this by overriding the relevant function in api.ts to also call the image alignment endpoint and used the output of the image alignment endpoint as input to the OCR endpoint. The relevant patch is here:

diff --git a/frontend/api/api.ts b/frontend/api/api.ts
index 0e48b60..ff22eb6 100644
--- a/frontend/api/api.ts
+++ b/frontend/api/api.ts
@@ -28,8 +28,11 @@ export const AlignImage = async (args: AlignImageArgs): Promise<AlignImageRespon
 export const ImageToText = async (args: ImageToTextArgs): Promise<ImageToTextResponse | null> => {
 
     const { sourceImage, templateImage, fieldNames } = args;
+
+    const result = await AlignImage({sourceImage, templateImage});
+
     const form = new URLSearchParams({
-        source_image: sourceImage,
+        source_image: result["result"],
         segmentation_template: templateImage,
         labels: JSON.stringify(fieldNames),
       });

@jonchang jonchang force-pushed the image-alignment-api branch from 9d0e2bb to 669ed48 Compare November 4, 2024 21:09
@jonchang jonchang marked this pull request as ready for review November 5, 2024 01:28
@jonchang jonchang added this pull request to the merge queue Nov 6, 2024
@jonchang
Copy link
Collaborator Author

jonchang commented Nov 6, 2024

Thanks Andrew!

Merged via the queue into main with commit 2d4c6c7 Nov 6, 2024
4 checks passed
@jonchang jonchang deleted the image-alignment-api branch November 6, 2024 21:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants