Image Classification
Transformers
PyTorch
English
sybil
medical
cancer
ct-scan
risk-prediction
healthcare
vision
Run this model with HF Jobs
Run Lab-Rasool/sybil on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs to fine-tune https://huggingface.co/Lab-Rasool/sybil. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/Lab-Rasool/sybil on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Instructions to use Lab-Rasool/sybil with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Lab-Rasool/sybil with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-classification", model="Lab-Rasool/sybil") pipe("https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/hub/parrots.png")# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("Lab-Rasool/sybil", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Delete example.py
Browse files1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374"""Simple example of using Sybil for lung cancer risk prediction"""
import sysimport os
# Install required packages if needed# !pip install torch torchvision transformers pydicom torchio sybil
# Import the modelfrom modeling_sybil_wrapper import SybilHFWrapperfrom configuration_sybil import SybilConfig
def predict_cancer_risk(dicom_paths): """ Predict lung cancer risk from DICOM files.
Args: dicom_paths: List of paths to DICOM files from a CT scan
Returns: Risk scores for years 1-6 """ # Load model print("Loading Sybil model...") config = SybilConfig() model = SybilHFWrapper.from_pretrained("Lab-Rasool/sybil")
# Run prediction print(f"Processing {len(dicom_paths)} DICOM files...") output = model(dicom_paths=dicom_paths, return_attentions=False)
# Extract risk scores risk_scores = output.risk_scores.numpy()
return risk_scores
def main(): # Example usage with demo data # In practice, replace with actual DICOM file paths demo_dicom_paths = [ "path/to/slice001.dcm", "path/to/slice002.dcm", # ... more slices ]
# For testing, you can download demo data: # Download from: https://github.com/reginabarzilaygroup/Sybil
print("=" * 50) print("Sybil Lung Cancer Risk Prediction") print("=" * 50)
# Uncomment when you have actual DICOM files: # risk_scores = predict_cancer_risk(demo_dicom_paths)
# Print results # print("\nLung Cancer Risk Predictions:") # print("-" * 30) # for year, score in enumerate(risk_scores, 1): # risk_pct = score * 100 # print(f"Year {year}: {risk_pct:.2f}% risk")
print("\nNote: This example requires actual DICOM files.") print("Please provide paths to LDCT scan DICOM files.") print("\nFor more information:") print("- Original paper: https://doi.org/10.1200/JCO.22.01345") print("- GitHub: https://github.com/reginabarzilaygroup/Sybil")
if __name__ == "__main__": main()example.pyDeleted-74