Image-Text-to-Text
Transformers
ONNX
Safetensors
English
medical
chest-xray
radiology
clip
blip
multimodal
cpu
Instructions to use GAD-Research-Lab/MedicalAI-Light-Weight with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use GAD-Research-Lab/MedicalAI-Light-Weight with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="GAD-Research-Lab/MedicalAI-Light-Weight")# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("GAD-Research-Lab/MedicalAI-Light-Weight", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use GAD-Research-Lab/MedicalAI-Light-Weight with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "GAD-Research-Lab/MedicalAI-Light-Weight" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "GAD-Research-Lab/MedicalAI-Light-Weight", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/GAD-Research-Lab/MedicalAI-Light-Weight
- SGLang
How to use GAD-Research-Lab/MedicalAI-Light-Weight with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "GAD-Research-Lab/MedicalAI-Light-Weight" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "GAD-Research-Lab/MedicalAI-Light-Weight", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "GAD-Research-Lab/MedicalAI-Light-Weight" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "GAD-Research-Lab/MedicalAI-Light-Weight", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use GAD-Research-Lab/MedicalAI-Light-Weight with Docker Model Runner:
docker model run hf.co/GAD-Research-Lab/MedicalAI-Light-Weight
| <# | |
| .SYNOPSIS | |
| One-click launcher for MedicalAI - Light Weight | |
| .DESCRIPTION | |
| Checks for Python, sets up venv, installs deps, and launches the app. | |
| Double-click this file or run: powershell -File launch.ps1 | |
| #> | |
| $ErrorActionPreference = "Stop" | |
| $ProjectRoot = Split-Path -Parent $MyInvocation.MyCommand.Path | |
| Set-Location $ProjectRoot | |
| $Host.UI.RawUI.WindowTitle = "MedicalAI - Light Weight" | |
| # ββ Check Python ββ | |
| $python = $null | |
| foreach ($cmd in @("python", "python3", "py")) { | |
| try { | |
| $v = & $cmd --version 2>&1 | |
| if ($v -match "Python 3\.(1[0-9]|[0-9]+)") { | |
| $python = $cmd | |
| break | |
| } | |
| } catch {} | |
| } | |
| if (-not $python) { | |
| Write-Host "Python 3.10+ is required but not found." -ForegroundColor Red | |
| Write-Host "Download from: https://www.python.org/downloads/" -ForegroundColor Yellow | |
| Write-Host "Make sure to check 'Add Python to PATH' during installation." -ForegroundColor Yellow | |
| Read-Host "Press Enter to exit" | |
| exit 1 | |
| } | |
| Write-Host "Using: $(& $python --version)" -ForegroundColor Green | |
| # ββ Virtual Environment ββ | |
| $venvPath = Join-Path $ProjectRoot ".venv" | |
| if (-not (Test-Path $venvPath)) { | |
| Write-Host "Creating virtual environment..." -ForegroundColor Cyan | |
| & $python -m venv $venvPath | |
| if (-not $?) { throw "Failed to create venv" } | |
| } | |
| # ββ Activate ββ | |
| $activate = Join-Path $venvPath "Scripts\Activate.ps1" | |
| . $activate | |
| # ββ Install Dependencies ββ | |
| $reqPath = Join-Path $ProjectRoot "requirements.txt" | |
| if (Test-Path $reqPath) { | |
| Write-Host "Installing dependencies..." -ForegroundColor Cyan | |
| pip install -q -r $reqPath 2>&1 | Out-Null | |
| if (-not $?) { | |
| Write-Host "Retrying with full output..." -ForegroundColor Yellow | |
| pip install -r $reqPath | |
| } | |
| } | |
| # ββ Check / Generate Default Models ββ | |
| $defaultClassifier = Join-Path $ProjectRoot "models\default\fusion_classifier.onnx" | |
| $checkpoint = Join-Path $ProjectRoot "checkpoints\fusion_model.pth" | |
| $onnxFull = Join-Path $ProjectRoot "checkpoints\onnx_full\fusion_full.onnx" | |
| if ((-not (Test-Path $checkpoint)) -and (-not (Test-Path $onnxFull)) -and (-not (Test-Path $defaultClassifier))) { | |
| Write-Host "No models found. Generating default models..." -ForegroundColor Yellow | |
| python setup_default.py | |
| Write-Host "Default models generated. The app will work immediately." -ForegroundColor Green | |
| } | |
| if (Test-Path $checkpoint) { | |
| Write-Host "Trained model found." -ForegroundColor Green | |
| } elseif (Test-Path $onnxFull) { | |
| Write-Host "ONNX pipeline found." -ForegroundColor Green | |
| } elseif (Test-Path $defaultClassifier) { | |
| Write-Host "Default model found. Train a proper model for accurate results." -ForegroundColor Yellow | |
| } | |
| # ββ Ask how to launch ββ | |
| Write-Host "" | |
| Write-Host "MedicalAI - Light Weight" -ForegroundColor Cyan | |
| Write-Host "========================" -ForegroundColor Cyan | |
| Write-Host "1) Web UI (recommended - opens in browser)" | |
| Write-Host "2) Command-line interface (CLI)" | |
| Write-Host "3) API Server (for website/app integration)" | |
| Write-Host "" | |
| $choice = Read-Host "Select (1, 2, or 3)" | |
| if ($choice -eq "2") { | |
| Write-Host "Launching CLI..." -ForegroundColor Green | |
| python run.py | |
| } elseif ($choice -eq "3") { | |
| # Ensure API deps are installed | |
| try { | |
| Import-Module python -ErrorAction Stop | |
| python -c "import fastapi" 2>$null | |
| } catch { | |
| Write-Host "Installing API dependencies..." -ForegroundColor Cyan | |
| python -m pip install "fastapi[standard]" uvicorn 2>&1 | Out-Null | |
| } | |
| Write-Host "Launching API server on http://127.0.0.1:8000 ..." -ForegroundColor Green | |
| Write-Host "Your website can connect to: http://127.0.0.1:8000/api" -ForegroundColor Yellow | |
| python quantization.py --mode serve-api | |
| } else { | |
| Write-Host "Launching web UI..." -ForegroundColor Green | |
| python web_ui.py | |
| } | |
| # ββ Keep window open on crash ββ | |
| if (-not $?) { | |
| Write-Host "App exited with error. Press Enter to close." -ForegroundColor Red | |
| Read-Host | |
| } | |