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 usage snippets for Google Health AI models #1084

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

Conversation

ndebuhr
Copy link
Contributor

@ndebuhr ndebuhr commented Dec 24, 2024

Adding usage snippets to improve Hugging Face Hub model pages for CXR Foundation and Derm Foundation - improving usability via example Python code and linked Jupyter notebooks. Doing this at the model library level, to complement the usage documentation in the model cards, so that the "Use this model" Hub button provides useful information (currently "integration status unknown").

Copy link
Member

@Vaibhavs10 Vaibhavs10 left a comment

Choose a reason for hiding this comment

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

Thanks for the PR @ndebuhr - re: both snippets:

  1. Both should actually be snippets (we discourage putting URLs to notebooks etc)
  2. For the other code snippet, we try to put the least possible lines of code that someone can understand/ work with. So would be great to reduce it.

Otherwise, I think I think this information can be nicely fit in the Model Card.

@ndebuhr
Copy link
Contributor Author

ndebuhr commented Jan 2, 2025

@Vaibhavs10 I can collapse some lines or remove some comments to further reduce the LOC, but I think that would impact readability (especially in the relatively low-width snippet modal). Hoping this second pass is better?

@ndebuhr ndebuhr requested a review from Vaibhavs10 January 2, 2025 23:29
Copy link
Member

@Vaibhavs10 Vaibhavs10 left a comment

Choose a reason for hiding this comment

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

Thanks a lot for iterating here, some last nits and we're good to merge!

@@ -95,6 +95,26 @@ export const bm25s = (model: ModelData): string[] => [
retriever = BM25HF.load_from_hub("${model.id}")`,
];

export const cxr_foundation = (model: ModelData): string[] => [
`# Install library
Copy link
Member

Choose a reason for hiding this comment

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

I think we can remove the install instructions completely from here and keep them in the model card (As they are currently and just start from from PIL import Image

import tensorflow as tf
import requests

# Load test image from SCIN Dataset
Copy link
Member

Choose a reason for hiding this comment

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

We can remove this comment to make it more concise, it's quite evident that we're passing an image via the image variable name and the URL path imo.

)
).SerializeToString()

# Load the model directly from Hugging Face Hub
Copy link
Member

Choose a reason for hiding this comment

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

same for this comment

# Load the model directly from Hugging Face Hub
loaded_model = from_pretrained_keras("google/derm-foundation")

# Call inference
Copy link
Member

Choose a reason for hiding this comment

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

and this

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