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

Simplify usage of the CXR Foundation Google Health AI model #1222

Merged
merged 20 commits into from
Feb 26, 2025
Merged
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
67a3e17
Add CXR Foundation and Derm Foundation model libraries (Google Health…
ndebuhr Nov 26, 2024
d02c152
Implement the PR review suggestion for Derm Foundation repo name casing
ndebuhr Nov 26, 2024
a9dc7dc
Implement the PR review suggestion for CXR Foundation repo name casing
ndebuhr Nov 26, 2024
1560b82
Add model library usage snippets to the CXR Foundation and Derm Found…
ndebuhr Dec 24, 2024
1e841b1
Merge branch 'main' of github.com:huggingface/huggingface.js into goo…
ndebuhr Dec 24, 2024
4f24453
Merge branch 'main' of github.com:huggingface/huggingface.js into goo…
ndebuhr Jan 2, 2025
f31df49
Remove the CXR Foundation model library snippet
ndebuhr Jan 2, 2025
719c7af
Simplify the Derm Foundation model library usage snippet - focus on i…
ndebuhr Jan 2, 2025
c4d3af3
Add a new usage snippet for the CXR Foundation model library, which u…
ndebuhr Jan 2, 2025
4809837
Merge branch 'main' of github.com:huggingface/huggingface.js into goo…
ndebuhr Jan 7, 2025
fa66830
Trim down the Derm Foundation usage snippet comments
ndebuhr Jan 7, 2025
60a89d5
Apply suggestions from code review
Wauplin Jan 15, 2025
fa5cead
Merge branch 'main' of github.com:huggingface/huggingface.js into goo…
ndebuhr Jan 21, 2025
35dc73a
Update Derm and CXR snippets to the latest state of feedback/discussions
ndebuhr Jan 21, 2025
ec71e2f
Merge branch 'main' into google-hai-libraries
Wauplin Jan 22, 2025
aa60ddd
Simplify the CXR Foundation snippet, including use of the latest pip-…
ndebuhr Feb 25, 2025
9a5317b
Merge branch 'main' of github.com:huggingface/huggingface.js into goo…
ndebuhr Feb 25, 2025
1ea8d79
Remove an unused ModelData parameter in the CXR Foundation usage snip…
ndebuhr Feb 25, 2025
60b4953
Merge branch 'main' into google-hai-libraries
Wauplin Feb 26, 2025
ea0ffd7
Update packages/tasks/src/model-libraries-snippets.ts
Wauplin Feb 26, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 4 additions & 11 deletions packages/tasks/src/model-libraries-snippets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,21 +110,14 @@ retriever = BM25HF.load_from_hub("${model.id}")`,
];

export const cxr_foundation = (): string[] => [
`!git clone https://github.com/Google-Health/cxr-foundation.git
import tensorflow as tf, sys, requests
sys.path.append('cxr-foundation/python/')
`# pip install git+https://github.com/Google-Health/cxr-foundation.git#subdirectory=python

# Install dependencies
major_version = tf.__version__.rsplit(".", 1)[0]
!pip install tensorflow-text=={major_version} pypng && pip install --no-deps pydicom hcls_imaging_ml_toolkit retrying

# Load image (Stillwaterising, CC0, via Wikimedia Commons)
# Load image as grayscale (Stillwaterising, CC0, via Wikimedia Commons)
import requests
from PIL import Image
from io import BytesIO
image_url = "https://upload.wikimedia.org/wikipedia/commons/c/c8/Chest_Xray_PA_3-8-2010.png"
response = requests.get(image_url, headers={'User-Agent': 'Demo'}, stream=True)
response.raw.decode_content = True # Ensure correct decoding
img = Image.open(BytesIO(response.content)).convert('L') # Convert to grayscale
img = Image.open(requests.get(image_url, headers={'User-Agent': 'Demo'}, stream=True).raw).convert('L')

# Run inference
from clientside.clients import make_hugging_face_client
Expand Down
Loading