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

Add new hdr image endpoints and hugging face endpoint #57

Merged
merged 2 commits into from
Sep 26, 2024

Conversation

CheesyLaZanya
Copy link
Collaborator

Resolves issues #50 , #51 , #52 , and #53

Below are screenshots of trying the endpoints in our OpenAPI setup:

Calculate HDR stats:

image

Generate JPG Preview:

image

(Tested copying the resulting data to a base64 online image viewer and the correct image was shown too)

This currently only supports .dng files and could benefit from additional tests of dng files from different devices in the future as well.

Retrieve Image Metadata:

image

Note, for now, this is intended to fail with GPS data instead of stripping it like the original PoC script. Stripping the data will be done as a future enhancement to avoid making this item bigger and to have something in place for the image upload work in the meantime.

This currently only supports .dng files and could benefit from additional tests of dng files from different devices in the future as well.

Upload to Hugging Face:

image

As a test of the hugging face endpoint, you can see the resulting upload here (while authenticated): https://huggingface.co/datasets/openmodelinitiative/hdr-submissions/tree/main



# Helper functions for HDR stats
def calculate_kurtosis(tensor: torch.Tensor):
Copy link
Collaborator

Choose a reason for hiding this comment

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

kurtosis is my vocabulary word for the day

async def upload_to_huggingface(file: UploadFile = File(...)):
HF_TOKEN = settings.HF_TOKEN

if not HF_TOKEN:
Copy link
Collaborator

Choose a reason for hiding this comment

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

might be beneficial to add a note somewhere indicating the token needs write permissions

Copy link
Collaborator

@fearnworks fearnworks left a comment

Choose a reason for hiding this comment

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

Some minor comments that might need followup, but nothing that would block merge. I tested the functionality and was able to upload to hf dataset

@CheesyLaZanya CheesyLaZanya merged commit 63037d5 into main Sep 26, 2024
2 checks passed
@CheesyLaZanya CheesyLaZanya deleted the 50-53-add-new-hdr-image-endpoints branch September 26, 2024 13:59
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