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

fix: process one image at a time with Gemini #648

Merged
merged 2 commits into from
Dec 22, 2024

Conversation

raphael0202
Copy link
Contributor

@raphael0202 raphael0202 commented Dec 22, 2024

Gemini sometimes skips some images when prediction price tag labels, leading to mismatch between price tag and predictions.
We process here one price tag at a time, preventing this from happening.

@raphael0202 raphael0202 force-pushed the process-gemini-single-image branch from a74e9e8 to 697cc8a Compare December 22, 2024 12:14
res = extract_from_price_tags(sample_files)
return Response(res, status=status.HTTP_200_OK)
labels = [extract_from_price_tag(sample_file) for sample_file in sample_files]
return Response({"labels": labels}, status=status.HTTP_200_OK)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the response changes ? so that we change the frontend integration

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The response is exactly the same, no? The Labels TypedDict doesn't exist anymore

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nevermind, no changes :)

)
return json.loads(response.text)


def extract_from_price_tags(images: Image.Image) -> Labels:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I re-added the previous function + added a warning: d813e0d

@raphodn raphodn linked an issue Dec 22, 2024 that may be closed by this pull request
@raphodn raphodn merged commit e0c251b into main Dec 22, 2024
6 checks passed
@raphodn raphodn deleted the process-gemini-single-image branch December 22, 2024 13:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Proof: use GenAI to extract price tag data
2 participants