🎉 30% OFF Pro PlanJetzt beanspruchen
Medical AI Background

API-Zugang

MedGemma & MedSigLIP API Nutzungsanleitung

Beginnen Sie mit Googles medizinischen KI-Modellen durch umfassenden API-Zugang. Beantragen Sie API-Schlüssel und integrieren Sie fortschrittliche medizinische KI-Funktionen in Ihre Anwendungen.

API-Zugang beantragen

Beginnen Sie mit MedGemma und MedSigLIP APIs

MedGemma API

Fortschrittliche medizinische Text- und multimodale KI-Modelle

Greifen Sie auf MedGemmas leistungsstarke Funktionen für medizinische Textanalyse, Bildverständnis und klinische Entscheidungsunterstützung zu.

Hauptmerkmale

  • Medizinische Textgenerierung und -analyse
  • Multimodale medizinische Bild- und Textverarbeitung
  • Klinische Frage-Antwort
  • Medizinische Berichtsgenerierung
  • Fine-Tuning-Funktionen

Verfügbare Modelle

MedGemma 4B Multimodal

Leichtgewichtiges Modell für medizinische Bild- und Textaufgaben

4B Parameter

MedGemma 27B Nur-Text

Großes Sprachmodell spezialisiert auf medizinischen Text

27B Parameter

MedGemma 27B Multimodal

Fortschrittliches multimodales Modell für komplexe medizinische Aufgaben

27B Parameter

MedSigLIP API

Medizinischer Bild-Text-Encoder für Klassifikation und Abruf

Nutzen Sie MedSigLIPs effiziente Dual-Tower-Architektur für medizinische Bildklassifikation, Zero-Shot-Inferenz und semantischen Abruf.

Hauptmerkmale

  • Zero-Shot medizinische Bildklassifikation
  • Semantischer Bildabruf
  • Medizinische Bild-Embeddings
  • Dateneffiziente Klassifikation
  • Cross-modale Ähnlichkeitssuche

Modellspezifikationen

Parameter:400M Parameter
Bildgröße:448×448 Pixel
Textlänge:64 Token maximal
Architektur:Dual-Tower-Encoder (Vision + Text)

Bereitstellungsoptionen

Wählen Sie die beste Bereitstellungsmethode für Ihre Bedürfnisse

Lokale Bereitstellung

Führen Sie Modelle lokal mit Hugging Face Transformers aus

Pros:

  • +Vollständige Kontrolle
  • +Keine API-Limits
  • +Datenschutz

Cons:

  • -Benötigt GPU-Ressourcen
  • -Setup-Komplexität
Best for: Entwicklung und Tests

Vertex AI Bereitstellung

Als REST-API-Endpunkte auf Google Cloud bereitstellen

Pros:

  • +Skalierbar
  • +Verwaltete Infrastruktur
  • +Produktionsbereit

Cons:

  • -Nutzungskosten
  • -Cloud-Abhängigkeit
Best for: Produktionsanwendungen

Batch-Verarbeitung

Verarbeiten Sie große Datensätze mit Vertex AI Batch-Jobs

Pros:

  • +Kosteneffektiv
  • +Großskalige Verarbeitung

Cons:

  • -Nicht Echtzeit
  • -Batch-Planung
Best for: Massendatenverarbeitung

Code Examples

Get started with implementation examples

MedGemma Implementation

Local Deployment

from transformers import pipeline

# Load MedGemma model
pipe = pipeline(
    "text-generation",
    model="google/medgemma-27b-text-it",
    torch_dtype="bfloat16",
    device="cuda"
)

# Generate medical text
response = pipe(
    "What are the symptoms of diabetes?",
    max_length=200,
    temperature=0.7
)

print(response[0]['generated_text'])

Vertex AI REST API

import requests
import json

# Vertex AI endpoint
endpoint_url = "https://your-endpoint.googleapis.com/v1/projects/your-project/locations/us-central1/endpoints/your-endpoint:predict"

# Request payload
payload = {
    "instances": [{
        "prompt": "What are the symptoms of diabetes?",
        "max_tokens": 200,
        "temperature": 0.7
    }]
}

# Make API request
headers = {
    "Authorization": "Bearer YOUR_ACCESS_TOKEN",
    "Content-Type": "application/json"
}

response = requests.post(endpoint_url, json=payload, headers=headers)
result = response.json()

print(result['predictions'][0]['generated_text'])

MedSigLIP Implementation

Local Deployment

from transformers import AutoModel, AutoProcessor
import torch
from PIL import Image

# Load MedSigLIP model
model = AutoModel.from_pretrained("google/medsiglip")
processor = AutoProcessor.from_pretrained("google/medsiglip")

# Load and process image
image = Image.open("medical_image.jpg")
text = "chest x-ray showing pneumonia"

# Process inputs
inputs = processor(
    text=[text],
    images=[image],
    return_tensors="pt",
    padding=True
)

# Get embeddings
with torch.no_grad():
    outputs = model(**inputs)
    image_embeds = outputs.image_embeds
    text_embeds = outputs.text_embeds

# Calculate similarity
similarity = torch.cosine_similarity(image_embeds, text_embeds)
print(f"Similarity score: {similarity.item():.4f}")

Zero-shot Classification

import torch
from transformers import AutoModel, AutoProcessor
from PIL import Image

# Load model and processor
model = AutoModel.from_pretrained("google/medsiglip")
processor = AutoProcessor.from_pretrained("google/medsiglip")

# Define classification labels
labels = [
    "normal chest x-ray",
    "pneumonia chest x-ray",
    "covid-19 chest x-ray",
    "lung cancer chest x-ray"
]

# Load image
image = Image.open("chest_xray.jpg")

# Process inputs
inputs = processor(
    text=labels,
    images=[image] * len(labels),
    return_tensors="pt",
    padding=True
)

# Get predictions
with torch.no_grad():
    outputs = model(**inputs)
    logits = outputs.logits_per_image
    probs = torch.softmax(logits, dim=-1)

# Get top prediction
top_idx = torch.argmax(probs, dim=-1)
confidence = probs[0, top_idx].item()

print(f"Prediction: {labels[top_idx]}")
print(f"Confidence: {confidence:.4f}")