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

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

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 marked this pull request as ready for review November 5, 2024 01:28
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.

1 participant