-
Notifications
You must be signed in to change notification settings - Fork 5
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
Conversation
Signed-off-by: Zachary Licastro <[email protected]>
…g face endpoints. Signed-off-by: Zachary Licastro <[email protected]>
|
||
|
||
# Helper functions for HDR stats | ||
def calculate_kurtosis(tensor: torch.Tensor): |
There was a problem hiding this comment.
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: |
There was a problem hiding this comment.
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
There was a problem hiding this 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
Resolves issues #50 , #51 , #52 , and #53
Below are screenshots of trying the endpoints in our OpenAPI setup:
Calculate HDR stats:
Generate JPG Preview:
(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:
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:
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