MedGemma 27B is a cutting-edge medical language and vision model developed by Google, designed to understand both medical text and images. Built as part of the Gemma 3 family, MedGemma comes in two flavors: a multimodal variant that handles both text and images, and a text-only variant focused purely on medical language tasks.
It has been trained using a wide range of de-identified medical data — including chest X-rays, dermatology photos, ophthalmology images, and radiology reports — and shows strong performance in medical reasoning, report generation, and visual question answering. While it offers an exciting baseline, MedGemma is meant as a starting point for developers to fine-tune or adapt into healthcare research projects, not as a plug-and-play clinical tool.
Performance and Validation
MedGemma was evaluated across a range of different multimodal classification, report generation, visual question answering, and text-based tasks.
Task and metric | Gemma 3 4B | MedGemma 4B | Gemma 3 27B | MedGemma 27B multimodal |
---|
Medical image classification | | | | |
MIMIC CXR** – macro F1 for top 5 conditions | 81.2 | 88.9 | 71.7 | 90.0 |
CheXpert CXR – macro F1 for top 5 conditions | 32.6 | 48.1 | 26.2 | 49.9 |
CXR14 – macro F1 for 3 conditions | 32.0 | 50.1 | 31.4 | 45.3 |
PathMCQA* (histopathology, internal**) – Accuracy | 37.1 | 69.8 | 42.2 | 71.6 |
US-DermMCQA* – Accuracy | 52.5 | 71.8 | 66.9 | 71.7 |
EyePACS* (fundus, internal) – Accuracy | 14.4 | 64.9 | 20.3 | 75.3 |
Visual question answering | | | | |
SLAKE (radiology) – Tokenized F1 | 40.2 | 72.3 | 42.5 | 70.0 |
VQA-RAD*** (radiology) – Tokenized F1 | 33.6 | 49.9 | 42.7 | 46.7 |
Knowledge and reasoning | | | | |
MedXpertQA (text + multimodal questions) – Accuracy | 16.4 | 18.8 | 22.0 | 26.8 |
Chest X-ray report generation
MedGemma chest X-ray (CXR) report generation performance was evaluated on MIMIC-CXR using the RadGraph F1 metric. We compare the MedGemma pre-trained checkpoint with our previous best model for CXR report generation, PaliGemma 2.
Metric | MedGemma 4B (pre-trained) | MedGemma 4B (tuned for CXR) | MedGemma 27B multimodal (pre-trained)* | PaliGemma 2 3B (tuned for CXR) | PaliGemma 2 10B (tuned for CXR) |
---|
Chest X-ray report generation | | | | | |
MIMIC CXR – RadGraph F1 | 29.5 | 30.3 | 27.0 | 28.8 | 29.5 |
Text evaluations
MedGemma 4B and text-only MedGemma 27B were evaluated across a range of text-only benchmarks for medical knowledge and reasoning.
The MedGemma models outperform their respective base Gemma models across all tested text-only health benchmarks.
Metric | Gemma 3 4B | MedGemma 4B | Gemma 3 27B | MedGemma 27B text-only | MedGemma 27B multimodal |
---|
MedQA (4-op) | 50.7 | 64.4 | 74.9 | 89.8 (best-of-5) 87.7 (0-shot) | 87.0 (best-of-5) 85.3 (0-shot) |
MedMCQA | 45.4 | 55.7 | 62.6 | 74.2 | 70.2 |
PubMedQA | 68.4 | 73.4 | 73.4 | 76.8 | 77.2 |
MMLU Med | 67.2 | 70.0 | 83.3 | 87.0 | 86.2 |
MedXpertQA (text only) | 11.6 | 14.2 | 15.7 | 25.7 | 23.7 |
AfriMed-QA (25 question test set) | 48.0 | 52.0 | 72.0 | 84.0 | 72.0 |
Medical record evaluations
All models were evaluated on a question answer dataset from synthetic FHIR data to answer questions about patient records. MedGemma 27B multimodal’s FHIR-specific training gives it significant improvement over other MedGemma and Gemma models.
Metric | Gemma 3 4B | MedGemma 4B | Gemma 3 27B | MedGemma 27B text-only | MedGemma 27B multimodal |
---|
EHRQA | 70.9 | 67.6 | 84.2 | 86.3 | 90.5 |
Recommended GPU Configuration for MedGemma-27B
GPU Model | VRAM (GB) | CUDA Version | Inference Speed | Notes |
---|
NVIDIA H100 SXM | 80 | 12.1–12.6 | Very Fast (~80–100 tok/s) | Tested on 1× H100 SXM with quantization (4-bit/8-bit) + optimizations |
NVIDIA A100 SXM | 80 | 11.8–12.2 | Very Fast (~60–80 tok/s) | Recommended for both FP16 and quantized runs; multimodal works well |
NVIDIA A100 | 40 | 11.8–12.2 | Fast (~30–50 tok/s) | Needs quantization + model offloading; better for text-only |
NVIDIA RTX 4090 | 24 | 12.x | Moderate (~15–25 tok/s) | Only usable with 4-bit quant + aggressive offloading; text-only preferred |
4× A100 SXM (or H100 SXM) | 4×80 | 11.8–12.6 | Ultra Fast (~150+ tok/s) | Ideal for full precision, parallelized multimodal inference |
Resources
Link: https://huggingface.co/google/medgemma-27b-it
Step-by-Step Process to Install MedGemma 27B and Build a Chest X-ray Analyzer Locally
For the purpose of this tutorial, we will use a GPU-powered Virtual Machine offered by NodeShift; however, you can replicate the same steps with any other cloud provider of your choice. NodeShift provides the most affordable Virtual Machines at a scale that meets GDPR, SOC2, and ISO27001 requirements.
Step 1: Sign Up and Set Up a NodeShift Cloud Account
Visit the NodeShift Platform and create an account. Once you’ve signed up, log into your account.
Follow the account setup process and provide the necessary details and information.
Step 2: Create a GPU Node (Virtual Machine)
GPU Nodes are NodeShift’s GPU Virtual Machines, on-demand resources equipped with diverse GPUs ranging from H100s to A100s. These GPU-powered VMs provide enhanced environmental control, allowing configuration adjustments for GPUs, CPUs, RAM, and Storage based on specific requirements.
Navigate to the menu on the left side. Select the GPU Nodes option, create a GPU Node in the Dashboard, click the Create GPU Node button, and create your first Virtual Machine deploy
Step 3: Select a Model, Region, and Storage
In the “GPU Nodes” tab, select a GPU Model and Storage according to your needs and the geographical region where you want to launch your model.
We will use 1 x H100 SXM GPU for this tutorial to achieve the fastest performance. However, you can choose a more affordable GPU with less VRAM if that better suits your requirements.
Step 4: Select Authentication Method
There are two authentication methods available: Password and SSH Key. SSH keys are a more secure option. To create them, please refer to our official documentation.
Step 5: Choose an Image
In our previous blogs, we used pre-built images from the Templates tab when creating a Virtual Machine. However, for running MedGemma 27B, we need a more customized environment with full CUDA development capabilities. That’s why, in this case, we switched to the Custom Image tab and selected a specific Docker image that meets all runtime and compatibility requirements.
We chose the following image:
nvidia/cuda:12.1.1-devel-ubuntu22.04
This image is essential because it includes:
- Full CUDA toolkit (including
nvcc
)
- Proper support for building and running GPU-based applications like MedGemma 27B.
- Compatibility with CUDA 12.1.1 required by certain model operations
Launch Mode
We selected:
Interactive shell server
This gives us SSH access and full control over terminal operations — perfect for installing dependencies, running benchmarks, and launching tools like MedGemma 27B.
Docker Repository Authentication
We left all fields empty here.
Since the Docker image is publicly available on Docker Hub, no login credentials are required.
Identification
nvidia/cuda:12.1.1-devel-ubuntu22.04
CUDA and cuDNN images from gitlab.com/nvidia/cuda. Devel version contains full cuda toolkit with nvcc.
This setup ensures that the MedGemma 27B runs in a GPU-enabled environment with proper CUDA access and high compute performance.
After choosing the image, click the ‘Create’ button, and your Virtual Machine will be deployed.
Step 6: Virtual Machine Successfully Deployed
You will get visual confirmation that your node is up and running.
Step 7: Connect to GPUs using SSH
NodeShift GPUs can be connected to and controlled through a terminal using the SSH key provided during GPU creation.
Once your GPU Node deployment is successfully created and has reached the ‘RUNNING’ status, you can navigate to the page of your GPU Deployment Instance. Then, click the ‘Connect’ button in the top right corner.
Now open your terminal and paste the proxy SSH IP or direct SSH IP.
Next, If you want to check the GPU details, run the command below:
nvidia-smi
Step 8: Install Miniconda & Packages
After completing the steps above, install Miniconda.
Miniconda is a free minimal installer for conda. It allows the management and installation of Python packages.
Anaconda has over 1,500 pre-installed packages, making it a comprehensive solution for data science projects. On the other hand, Miniconda allows you to install only the packages you need, reducing unnecessary clutter in your environment.
We highly recommend installing Python using Miniconda. Miniconda comes with Python and a small number of essential packages. Additional packages can be installed using the package management systems Mamba or Conda.
For Linux/macOS:
Download the Miniconda installer script:
sudo apt update && apt install wget -y
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
For Windows:
- Download the Windows Miniconda installer from the official website.
- Run the installer and follow the installation prompts
Run the installer script:
bash Miniconda3-latest-Linux-x86_64.sh
After Installing Miniconda, you will see the following message:
Thank you for installing Miniconda 3! This means Miniconda is installed in your working directory or on your operating system.
Check the screenshot below for proof:
Step 9: Activate Conda and Create a Environment
After the installation process, activate Conda using the following command:
export PATH="/root/miniconda3/bin:$PATH"
conda init
exec "$SHELL"
Create a Conda Environment using the following command:
conda create -n medgemma python=3.11 -y
conda activate medgemma
conda create
: This is the command to create a new environment.
-n
medgemma: The -n
flag specifies the name of the environment you want to create. Here medgemma
is the name of the environment you’re creating. You can name it anything you like.
python=3.11
: This specifies the version of Python that you want to install in the new environment. In this case, it’s Python 3.11.
-y
: This flag automatically answers “yes” to all prompts during the creation process, so the environment is created without asking for further confirmation.
Step 10: Install Required Python Packages
Once your environment is activated, install all required Python packages.
Run the following commands one by one:
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121
This installs:
- torch → core PyTorch library
- torchvision → for image processing
- torchaudio → for audio (needed as dependency)
Then, run:
pip install torch transformers accelerate pillow requests
This installs:
- transformers → for loading MedGemma 27B
- accelerate → for multi-GPU and optimized inference
- pillow → for image loading/processing
- requests → for fetching online files
Step 11: Access MedGemma-27B-IT Model on Hugging Face
Before you can download and use the MedGemma model, you must request access from Hugging Face.
Go to the model page:
https://huggingface.co/google/medgemma-27b-it
Log in to your Hugging Face account.
If you don’t have one, create a free account.
Scroll down and acknowledge the license:
- Click the Acknowledge license button.
- Agree to share your contact info (email + username) with the authors.
Wait a few seconds — you should see:
Gated model - You have been granted access to this model
.
Step 12: Authenticate Hugging Face CLI and Log In
Now that you have access to the MedGemma model, you need to log in to Hugging Face from your terminal so the scripts can pull the model.
In your terminal (inside the VM), run:
huggingface-cli login
Paste your Hugging Face token when prompted (input will be hidden).
When asked:
Add token as git credential? (y/n)
You can type n
(no) — unless you also plan to push to Hugging Face.
You should see a confirmation message:
Token is valid (permission: fineGrained).
The token 'MedGemma 27B' has been saved...
You are now authenticated and ready to load the MedGemma model in your Python scripts.
Step 13: Connect to your GPU VM using Remote SSH
- Open VS Code on your Mac.
- Press
Cmd + Shift + P
, then choose Remote-SSH: Connect to Host
.
- Select your configured host.
- Once connected, you’ll see
SSH: 38.29.145.28
(Your VM IP) in the bottom-left status bar (like in the image).
Step 14: Write the Python Script to Run MedGemma on X-ray Images
Inside your VM (or local machine), create a Python script named:
image_chat.py
In this script, you will:
Import necessary modules:
import os
from transformers import AutoProcessor, AutoModelForImageTextToText
from PIL import Image
import requests
import torch
Load your Hugging Face token:
token = "hf_XXXXXXXXXXXXXXXXXXXXXXXXXXXX" # replace with your real token
Load the MedGemma model:
model_id = "google/medgemma-27b-it"
model = AutoModelForImageTextToText.from_pretrained(
model_id,
torch_dtype=torch.bfloat16,
device_map="auto",
token=token
)
processor = AutoProcessor.from_pretrained(model_id, token=token)
Load an example chest X-ray image (public domain link or local file).
Create the chat prompt:
messages = [
{"role": "system", "content": [{"type": "text", "text": "You are an expert radiologist."}]},
{"role": "user", "content": [{"type": "text", "text": "Describe this X-ray"}, {"type": "image", "image": image}]}
]
Complete Python Script:
from transformers import AutoProcessor, AutoModelForImageTextToText
from PIL import Image
import requests
import torch
# Hugging Face token (replace with yours if needed)
token = "hf_tzPKgmEzAezCRBlKGf0PwtRtncgGRUERbR"
# Model ID
model_id = "google/medgemma-27b-it"
# Load model and processor
model = AutoModelForImageTextToText.from_pretrained(
model_id,
torch_dtype=torch.bfloat16,
device_map="auto",
token=token
)
processor = AutoProcessor.from_pretrained(
model_id,
token=token
)
print("✅ MedGemma-27B-IT model loaded successfully!")
# Load image (public X-ray example)
image_url = "https://upload.wikimedia.org/wikipedia/commons/c/c8/Chest_Xray_PA_3-8-2010.png"
headers = {"User-Agent": "Mozilla/5.0"}
response = requests.get(image_url, headers=headers, stream=True)
image = Image.open(response.raw)
print("✅ Image loaded successfully!")
# Create chat messages
messages = [
{
"role": "system",
"content": [{"type": "text", "text": "You are an expert radiologist."}]
},
{
"role": "user",
"content": [
{"type": "text", "text": "Describe this X-ray"},
{"type": "image", "image": image}
]
}
]
# Prepare inputs
inputs = processor.apply_chat_template(
messages,
add_generation_prompt=True,
tokenize=True,
return_dict=True,
return_tensors="pt"
).to(model.device, dtype=torch.bfloat16)
input_len = inputs["input_ids"].shape[-1]
# Generate response
with torch.inference_mode():
generation = model.generate(
**inputs,
max_new_tokens=200,
do_sample=False
)
generated_text = processor.batch_decode(
generation[:, input_len:],
skip_special_tokens=True
)[0]
print("\n💬 MedGemma description of the X-ray:\n")
print(generated_text)
Summary of what it does:
- Loads MedGemma 27B IT model.
- Fetches a public chest X-ray image.
- Creates a chat prompt pretending to be an expert radiologist.
- Runs inference.
- Prints the generated medical report to your terminal.
Step 14: Run the Script and Generate the X-ray Report
In your terminal, run:
python3 image_chat.py
You should see:
- Model loaded successfully message
- Image loaded successfully message
- And then: a detailed MedGemma description of the X-ray
The model will provide:
- Overall impression
- Detailed breakdown (lungs, pleura, heart, mediastinum, etc.)
- Any detected abnormalities (if present)
Step 15: Write the Python Script to Run MedGemma-27B Text Chat Assistant
Make a file called text_chat.py
and paste this complete script into it:
Import required libraries:
import os
from transformers import pipeline
import torch
Bring in:
os
→ system ops (if needed)
pipeline
→ from Hugging Face Transformers
torch
→ for device & precision settings
Provide your Hugging Face token:
token = "hf_your token"
Paste your personal Hugging Face access token.
Initialize the model pipeline:
pipe = pipeline(
"image-to-text",
model="google/medgemma-27b-it",
torch_dtype=torch.bfloat16,
device="cuda",
token=token
)
Load MedGemma-27B model with:
image-to-text
pipeline
- CUDA device (GPU)
- bfloat16 precision (good for H100 GPUs)
Prepare system + user messages:
messages = [
{
"role": "system",
"content": [{"type": "text", "text": "You are a helpful medical assistant."}]
},
{
"role": "user",
"content": [{"type": "text", "text": "How do you differentiate bacterial from viral pneumonia?"}]
}
]
Compose a multi-turn message list:
- System prompt → sets model role
- User prompt → gives the actual medical question
Generate response:
output = pipe(text=messages, max_new_tokens=200)
Run the pipeline, letting it generate up to 200 tokens.
Display the model’s response:
print("\n💬 Response:")
print(output[0]["generated_text"][-1]["content"])
Print the model’s last generated message content to the terminal.
Complete Script:
import os
from transformers import pipeline
import torch
# ✅ Use your Hugging Face token directly
token = "hf_tzPKgmEzAezCRBlKGf0PwtRtncgGRUERbR"
# ✅ Initialize pipeline
pipe = pipeline(
"image-to-text",
model="google/medgemma-27b-it",
torch_dtype=torch.bfloat16,
device="cuda",
token=token
)
# ✅ Define messages (system + user)
messages = [
{
"role": "system",
"content": [{"type": "text", "text": "You are a helpful medical assistant."}]
},
{
"role": "user",
"content": [{"type": "text", "text": "How do you differentiate bacterial from viral pneumonia?"}]
}
]
# ✅ Generate response
output = pipe(text=messages, max_new_tokens=200)
# ✅ Print response
print("\n💬 Response:")
print(output[0]["generated_text"][-1]["content"])
This script:
- Uses
pipeline
→ image-to-text
(but functions like text chat!)
- Uses bfloat16 for memory efficiency
- Runs on CUDA GPU
- Prints out only the last message from generated outputs
Step 16: Run the Script and Get the Text Response
After writing the text_chat.py
script, it’s time to run it and see if the model responds as expected.
In your terminal, execute:
python3 text_chat.py
What happens:
- The model loads its checkpoint shards (you’ll see a progress bar like
12/12
).
- You’ll get a warning if the image processor is set to
slow
(you can ignore this or optimize later).
- You’ll see confirmation:
Device set to use cuda
Response generated
The model outputs:
- A text explanation answering your prompt (in this case, explaining differences between bacterial and viral pneumonia).
Example Output:
Okay, as a helpful medical assistant, I can explain the key differences between bacterial and viral pneumonia...
Run Text Chat Script with Different Prompts
You can reuse the same text_chat.py
script — the only thing you change is the user prompt.
Example from screenshot:
{
"role": "user",
"content": [{"type": "text", "text": "What are the warning signs of a heart attack?"}]
}
Then, you run:
python3 text_chat.py
Output:
- The model will now return a medical assistant-style answer describing warning signs of a heart attack, including symptoms, locations, and notes.
How to adapt:
To ask anything new, just edit the user prompt in the script:
"content": [{"type": "text", "text": "YOUR NEW QUESTION HERE"}]
Examples you can try:
- “What are the common symptoms of a stroke?”
- “How do you treat mild dehydration at home?”
- “What is the difference between Type 1 and Type 2 diabetes?”
Upto Now: Terminal Tests & Script Runs
Up to this point, we have successfully installed, configured, and tested the MedGemma 27B model entirely from the terminal. We ran Python scripts, modified prompts directly in the code, and validated responses right inside the console window. While this works well for testing, it’s not the most user-friendly approach — especially if you want to explore different prompts or share the experience with others.
Now, we’re stepping up.
We will integrate Gradio so we can run and test the model directly from the browser with a clean, interactive interface — no more editing scripts or restarting terminals for each new question!
Step-by-Step Process to Test MedGemma 27B with Gradio
Up to this point, we’ve successfully tested and run MedGemma 27B entirely through the terminal, adjusting prompts directly in the script each time to generate responses. Now, we’re stepping things up by integrating Gradio — this will allow us to build an interactive web interface where we can test the model live in the browser, making the process smoother, faster, and more user-friendly without needing to touch the underlying code for every new prompt or image. Let’s walk through how to set this up!
Step 1: Install Gradio
To begin, we install Gradio inside our Python environment. Gradio is the tool that will let us create a simple, interactive web app to interact with the MedGemma 27B model.
Run the following command in your terminal:
pip install gradio
Step 2: Create the Gradio Chat Script
Now, we set up a Python script to serve MedGemma 27B as a web-based chat assistant using Gradio. This script connects the model with a simple browser UI where you can type medical questions and get instant replies.
Make a file called gradio_chat.py
and paste this complete script into it:
import gradio as gr
from transformers import pipeline
# Initialize pipeline
pipe = pipeline(
"image-text-to-text",
model="google/medgemma-27b-it",
torch_dtype="bfloat16",
device="cuda",
token="hf_tzPKgmEzAezCRBlKGf0tPwRtNcqGRUBER"
)
# Define chat function
def chat_medical_assistant(user_message, history):
messages = [
{"role": "system", "content": [{"type": "text", "text": "You are a helpful medical assistant."}]},
{"role": "user", "content": [{"type": "text", "text": user_message}]}
]
output = pipe(text=messages, max_new_tokens=300)
return output[0]["generated_text"][-1]["content"]
# Launch Gradio interface
gr.ChatInterface(
chat_medical_assistant,
title="🩺 MedGemma Medical Chat Assistant"
).launch()
- What this does:
- Loads the MedGemma 27B IT model
- Wraps it in a Gradio
ChatInterface
- Launches it at
http://127.0.0.1:7860
so you can chat live in your browser
Step 3: Run the Gradio app
python3 gradio_chat.py
This command will launch the MedGemma Medical Chat Assistant in your browser at the displayed local URL (e.g., http://127.0.0.1:7860).
Step 4: Set up SSH port forwarding to access Gradio UI in your local browser
ssh -p 20713 -L 7860:127.0.0.1:7860 root@115.124.123.238
This command forwards the remote port 7860
to your local machine, so you can open http://127.0.0.1:7860
in your local browser and access the MedGemma Gradio app running on the VM.
Step 5: Open MedGemma Chat UI in your browser
Go to your local browser and open:
http://127.0.0.1:7860
You will see the MedGemma Medical Chat Assistant Gradio interface where you can directly type medical prompts, submit them, and view real-time AI-generated answers — all running on your GPU VM, now accessible through your browser! Jana
Step 6: Start chatting with MedGemma in your browser
You can now type any medical question or health-related prompt directly into the Gradio chat interface (like shown in the image).
Examples you can try:
- What are the early signs of pneumonia in adults?
- How to differentiate bacterial vs. viral pneumonia?
- What are the warning signs of a heart attack?
Submit, and you’ll get a detailed, AI-generated medical explanation instantly in your browser!
Step 7: Prepare Gradio script for X-ray image analysis
Make a file called gradio_image.py
and paste this complete script into it:
import gradio as gr
from transformers import AutoProcessor, AutoModelForImageTextToText
from PIL import Image
import torch
# Model setup
model_id = "google/medgemma-27b-it"
token = "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"
model = AutoModelForImageTextToText.from_pretrained(
model_id,
torch_dtype=torch.bfloat16,
device_map="auto",
token=token
)
processor = AutoProcessor.from_pretrained(
model_id,
token=token
)
def analyze_xray(img):
messages = [
{"role": "system", "content": [{"type": "text", "text": "You are an expert radiologist."}]},
{"role": "user", "content": [{"type": "image", "image": img}, {"type": "text", "text": "Describe this X-ray in detail."}]}
]
inputs = processor.apply_chat_template(
messages,
add_generation_prompt=True,
tokenize=True,
return_dict=True,
return_tensors="pt"
).to(model.device, dtype=torch.bfloat16)
input_len = inputs["input_ids"].shape[-1]
with torch.inference_mode():
generation = model.generate(**inputs, max_new_tokens=300, do_sample=False)
generation = generation[0][input_len:]
decoded = processor.decode(generation, skip_special_tokens=True)
return decoded
# Gradio interface
gr.Interface(
fn=analyze_xray,
inputs=gr.Image(type="pil"),
outputs="text",
title="🩻 MedGemma Chest X-ray Analyzer"
).launch()
You are now setting up the gradio_image.py
script that:
- Loads the MedGemma 27B model
- Takes an uploaded chest X-ray image
- Sends it to the model with the prompt “Describe this X-ray in detail”
- Returns an expert-style medical description
Step 8: Run the Gradio app
python3 gradio_image.py
This will launch the Gradio image analyzer and you can access it in your browser at:
http://127.0.0.1:7860
Step 9: Open MedGemma Chest X-ray Analyzer in Your Browser
Open your browser and go to:
http://127.0.0.1:7860
You will now see the MedGemma Chest X-ray Analyzer Gradio interface running.
You can upload an X-ray image (for example, from the NIH dataset or any PNG you extracted earlier) and click Submit.
The model will generate a detailed medical description of the X-ray on the right side.
Step 10: Upload X-ray Image and Get Analysis
Open the browser interface, upload a chest X-ray image, and click Submit.
You will see the MedGemma model generate a detailed medical breakdown of the X-ray on the right side, covering lungs, pleura, heart, and mediastinum findings.
Conclusion
In this guide, we walked through the full journey of setting up MedGemma 27B — from spinning up a GPU virtual machine, installing and configuring the environment, running terminal scripts, and finally building an interactive Gradio interface for both medical chat and chest X-ray analysis.
MedGemma 27B isn’t just another AI model; it’s a powerful foundation built for advancing medical research and experimentation. Whether you’re working on medical Q&A bots, radiology report generation, or healthcare research tools, MedGemma gives you a strong head start — but it’s not a plug-and-play clinical solution. As developers and researchers, it’s on us to fine-tune, validate, and adapt it responsibly for our own use cases.
With the combination of cutting-edge hardware like the H100 SXM GPU and flexible open-source tools like Gradio, we can now bridge AI research with real, interactive applications, running directly in the browser — no more heavy terminal workflows.
So go ahead: experiment, build, test, and push the boundaries. The future of healthcare AI is wide open, and you now have one of the most exciting tools in your hands to explore it.