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
File size: 2,471 Bytes
e93bfbd | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 | """
Build a standalone .exe for Windows using PyInstaller.
No Python installation needed on the target machine.
Usage:
python build_exe.py # build web_ui.exe
python build_exe.py --cli # build run.exe (CLI)
python build_exe.py --all # build both
Requires: pip install pyinstaller
"""
import argparse
import os
import shutil
import subprocess
import sys
DIST_DIR = "./dist"
def build_exe(script, name=None):
if name is None:
name = os.path.splitext(os.path.basename(script))[0]
print(f"[cyan]Building {name}.exe from {script}...[/cyan]")
cmd = [
sys.executable, "-m", "PyInstaller",
"--onefile",
"--console",
"--name", name,
"--distpath", DIST_DIR,
"--workpath", "./build",
"--specpath", "./build",
"--add-data", "config.json;.",
script,
]
subprocess.check_call(cmd)
exe_path = os.path.join(DIST_DIR, f"{name}.exe")
if os.path.exists(exe_path):
size_mb = os.path.getsize(exe_path) / 1024 / 1024
print(f"[green] Created: {exe_path} ({size_mb:.0f} MB)[/green]")
else:
print(f"[red] Failed to create {name}.exe[/red]")
# Clean up build artifacts
for d in ["./build", "*.spec"]:
try:
if os.path.isdir(d):
shutil.rmtree(d)
except Exception:
pass
for f in os.listdir("."):
if f.endswith(".spec"):
os.remove(f)
def main():
parser = argparse.ArgumentParser(description="Build standalone executable")
parser.add_argument("--cli", action="store_true", help="Build CLI executable")
parser.add_argument("--all", action="store_true", help="Build all executables")
args = parser.parse_args()
try:
import PyInstaller # noqa: F401
except ImportError:
print("PyInstaller is required. Install with: pip install pyinstaller")
sys.exit(1)
os.makedirs(DIST_DIR, exist_ok=True)
if args.all:
build_exe("web_ui.py")
build_exe("run.py")
build_exe("batch_predict.py")
elif args.cli:
build_exe("run.py")
else:
build_exe("web_ui.py")
print(f"\n[green]Done. Executables in ./{DIST_DIR}/[/green]")
print("[yellow]Note: The .exe still needs model files (checkpoints/).[/yellow]")
print("[yellow]Copy the entire project folder to the target machine.[/yellow]")
if __name__ == "__main__":
main()
|