How to use from the
Use from the
Transformers library
# Gated model: Login with a HF token with gated access permission
hf auth login
# Use a pipeline as a high-level helper
from transformers import pipeline

pipe = pipeline("image-text-to-text", model="icdevelop/pai1-medgemma-27b")
messages = [
    {
        "role": "user",
        "content": [
            {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"},
            {"type": "text", "text": "What animal is on the candy?"}
        ]
    },
]
pipe(text=messages)
# Load model directly
from transformers import AutoProcessor, AutoModelForMultimodalLM

processor = AutoProcessor.from_pretrained("icdevelop/pai1-medgemma-27b")
model = AutoModelForMultimodalLM.from_pretrained("icdevelop/pai1-medgemma-27b", device_map="auto")
messages = [
    {
        "role": "user",
        "content": [
            {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"},
            {"type": "text", "text": "What animal is on the candy?"}
        ]
    },
]
inputs = processor.apply_chat_template(
	messages,
	add_generation_prompt=True,
	tokenize=True,
	return_dict=True,
	return_tensors="pt",
).to(model.device)

outputs = model.generate(**inputs, max_new_tokens=40)
print(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:]))
Quick Links

You need to agree to share your contact information to access this model

This repository is publicly accessible, but you have to accept the conditions to access its files and content.

You must read and accept the Access Agreement before downloading. This model is not a medical device and must be operated under the supervision of a licensed pharmacist. By accepting, you acknowledge that: (1) it is not for diagnosis or treatment and all output must be reviewed by a licensed pharmacist; (2) part of the drug knowledge base is AI-generated and not yet pharmacist-reviewed, so it may contain inaccuracies; (3) you accept the risk and responsibility of your own use, and the developer accepts no liability for resulting harm; (4) you are bound by the HAI-DEF Terms (https://developers.google.com/health-ai-developer-foundations/terms); (5) clinical use on real patients without a supervising pharmacist or physician is prohibited.

Log in or Sign Up to review the conditions and access this model content.

pai1-medgemma-27b — Thai Pharmacy Assistant (RAG)

⚠️ This model MUST be used with RAG + the Knowledge Base

Read before use

This model is not a self-contained drug knowledge store. If it is served on its own and queried directly without retrieved context, it may generate inaccurate drug information — and on some metrics it performs worse than the base model. For every query you must retrieve real drug facts from the knowledge base (icdevelop/thai-pharma-kb) and inject them into the prompt. See rag_example.py.

Usage Score Route / interaction errors
Model alone (no RAG) 51.0% 40.0%
+ RAG (required) 68.5% 27.0%
base-27b + RAG (reference) 66.0% 29.0%

DRAFT card — pharmacist and legal review required before public release. The KB is not yet pharmacist-reviewed.

A Thai community-pharmacy assistant fine-tuned from google/medgemma-27b-it by I C Develop Co., Ltd.

Not a medical device

  • Not a medical device. It does not diagnose or treat. All output must be reviewed by a licensed pharmacist before real-world use.
  • Scoped to the Thai community-pharmacy domain only (OTC guidance, drug information, interactions, legal drug class, physician referral).
  • Image input is for medicine boxes, labels, and prescriptions only — it does not read X-rays or lab films.

How to use (RAG — see rag_example.py)

vllm serve icdevelop/pai1-medgemma-27b --dtype bfloat16 --max-model-len 8192 \
    --served-model-name pai --seed 0 --enforce-eager
huggingface-cli download icdevelop/thai-pharma-kb --repo-type dataset

Retrieve the drug facts from the TMT registry / KB and inject them into the prompt on every call. The reference block and question are written in Thai, since the model is purpose-built for Thai (example prompt shown in Thai intentionally):

[ข้อมูลอ้างอิงจากทะเบียนยา TMT — ใช้ข้อมูลนี้เท่านั้น]
ชื่อการค้า: <brand> | ตัวยา: <active> | รูปแบบ: <form> | ประเภท: <legal>
  <active>: <สรรพคุณ> | ขนาด <dose> | ประเภท <legal>

[คำถามลูกค้า] <question>

Instruct the model to answer only from the provided context and to decline when the information is absent (ไม่พบข้อมูลยานี้ กรุณาสอบถามเภสัชกร).

Data provenance & review status — please read

Source Count Status
TMT drug registry (Thai MoPH) 31,034 products Official government data
Ingredient KB (per active ingredient) 1,918 ingredients AI-generated — not yet pharmacist-reviewed
  • Dosage, indications, and legal class in the KB were written by an LLM and are not yet pharmacist-reviewed. A deterministic audit flagged 534 ingredients (those the model itself was least confident about) for priority review. One observed error type: an antibiotic incorrectly labeled as a cough remedy, which then propagates to every brand containing that ingredient — this is precisely why the KB must be pharmacist-reviewed before real-world use.

Benchmark methodology

thai_pharma_bench_v2 — 200 held-out cases, ground truth derived from TMT + KB (not judge-only), measured deterministically (vLLM --enforce-eager + greedy). Reproducible across runs (±0.5%).

Limitations & safety

  • The model alone recalls drug information poorly — it must always be used with RAG.
  • Not a medical device. Output must be pharmacist-reviewed and never applied directly to patients without a qualified professional.
  • The KB is not yet reviewed and may contain drug-information inaccuracies.

License (HAI-DEF)

A Model Derivative of google/medgemma-27b-it under the Health AI Developer Foundations Terms. Modified by I C Develop Co., Ltd. (LoRA SFT, vision tower frozen). Redistribution requires: (1) attaching the HAI-DEF Terms, (2) including the §3.2 use restrictions, (3) including the NOTICE, and (4) stating the modification.

Not a medical device; not for clinical use without a licensed pharmacist. Contact: I C Develop Co., Ltd.

Downloads last month
89
Safetensors
Model size
27B params
Tensor type
BF16
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for icdevelop/pai1-medgemma-27b

Adapter
(8)
this model

Collection including icdevelop/pai1-medgemma-27b