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
| # One-click launcher for MedicalAI on Linux/Mac | |
| set -e | |
| SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" | |
| cd "$SCRIPT_DIR" | |
| # ββ Check Python ββ | |
| PYTHON="" | |
| for cmd in python3 python; do | |
| if command -v "$cmd" &>/dev/null; then | |
| ver=$("$cmd" --version 2>&1) | |
| if echo "$ver" | grep -qE "Python 3\.(1[0-9]|[0-9]+)"; then | |
| PYTHON="$cmd" | |
| break | |
| fi | |
| fi | |
| done | |
| if [ -z "$PYTHON" ]; then | |
| echo "Error: Python 3.10+ is required but not found." | |
| echo "Install from: https://www.python.org/downloads/" | |
| read -rp "Press Enter to exit" | |
| exit 1 | |
| fi | |
| echo "Using: $($PYTHON --version)" | |
| # ββ Virtual Environment ββ | |
| if [ ! -d ".venv" ]; then | |
| echo "Creating virtual environment..." | |
| $PYTHON -m venv .venv | |
| fi | |
| source .venv/bin/activate | |
| # ββ Install Dependencies ββ | |
| if [ -f "requirements.txt" ]; then | |
| echo "Installing dependencies..." | |
| pip install -q -r requirements.txt 2>/dev/null || pip install -r requirements.txt | |
| fi | |
| # ββ Check / Generate Default Models ββ | |
| if [ ! -f "checkpoints/fusion_model.pth" ] && \ | |
| [ ! -f "checkpoints/onnx_full/fusion_full.onnx" ] && \ | |
| [ ! -f "models/default/fusion_classifier.onnx" ]; then | |
| echo "No models found. Generating default models..." | |
| python setup_default.py | |
| echo "Default models generated. The app will work immediately." | |
| fi | |
| if [ -f "checkpoints/fusion_model.pth" ]; then | |
| echo "Trained model found." | |
| elif [ -f "checkpoints/onnx_full/fusion_full.onnx" ]; then | |
| echo "ONNX pipeline found." | |
| elif [ -f "models/default/fusion_classifier.onnx" ]; then | |
| echo "Default model found. Train for accurate results." | |
| fi | |
| # ββ Launch ββ | |
| echo "" | |
| echo "MedicalAI - Light Weight" | |
| echo "========================" | |
| echo "1) Web UI (recommended - opens in browser)" | |
| echo "2) Command-line interface (CLI)" | |
| echo "3) API Server (for website/app integration)" | |
| echo "" | |
| read -rp "Select (1, 2, or 3): " choice | |
| if [ "$choice" = "2" ]; then | |
| echo "Launching CLI..." | |
| python run.py | |
| elif [ "$choice" = "3" ]; then | |
| echo "Launching API server on http://127.0.0.1:8000 ..." | |
| echo "Your website can connect to: http://127.0.0.1:8000/api" | |
| pip install -q "fastapi[standard]" uvicorn 2>/dev/null || pip install "fastapi[standard]" uvicorn | |
| python quantization.py --mode serve-api | |
| else | |
| if python -c "import gradio" 2>/dev/null; then | |
| python web_ui.py | |
| else | |
| echo "Installing gradio..." | |
| pip install gradio | |
| python web_ui.py | |
| fi | |
| fi | |