Downloads · 30 days
2
6% of all-time downloads
introvoyz041/surgicalcopilot-phase2-27b
surgicalcopilot-phase2-27b is a text generation model from introvoyz041. Use it when you need the model to write or continue text. It is set up for peft. The card lists the license as apache-2.0.
LoRA adapter for MedGemma-27B fine-tuned on post-discharge surgical patient monitoring (SAFEGUARD system).
Downloads · 30 days
2
6% of all-time downloads
All-time downloads
36
Public
Repo size
488 MB
Likes
0
Public
Click a slice to open those files.
.safetensors454 MB · 93%
From the Hugging Face model README
LoRA adapter for MedGemma-27B fine-tuned on post-discharge surgical patient monitoring (SAFEGUARD system).
[!WARNING] Live Demo URL Update: The original Azure URL submitted (
https://surgicalcopilot-app.azurewebsites.net/) is currently unavailable due to an unexpected Microsoft Azure account freeze. We have migrated the frontend to Vercel so the application can still be evaluated.
This is a LoRA adapter trained on Google's MedGemma-27B for post-discharge recovery monitoring (days 5-30 after surgery). The model performs risk stratification of surgical patients into three categories:
The model integrates patient-reported symptoms (pain, temperature, wound status, mobility) with optional wearable device data to detect complications like surgical site infection, anastomotic leak, DVT, and post-discharge deterioration.
{
"r": 16,
"lora_alpha": 32,
"lora_dropout": 0.05,
"bias": "none",
"task_type": "CAUSAL_LM",
"target_modules": [
"q_proj", "k_proj", "v_proj", "o_proj",
"gate_proj", "up_proj", "down_proj"
]
}
| Metric | Score |
|---|---|
| Parse Rate | 99.5% |
| Schema Compliance | 100% |
| Label Accuracy | 92.8% |
| Macro F1 | 0.93 |
| RED Recall (Critical) | 96.7% |
| RED Precision | 94.2% |
{
"doc_type": "safeguard_assessment",
"risk_level": "RED",
"risk_score": 0.87,
"timeline_deviation": "behind_expected",
"trajectory": "deteriorating",
"trigger_reason": "Surgical site infection suspected",
"domain_flags": {
"wound": "moderate",
"pain": "severe",
"mobility": "impaired",
"gi": "normal",
"respiratory": "normal"
},
"patient_message": {
"summary": "Your wound shows signs that need evaluation. Please contact your surgeon today.",
"self_care": [
"Take temperature every 4 hours",
"Keep wound clean and dry",
"Do not apply any creams"
],
"next_checkin": "12 hours or if symptoms worsen"
},
"copilot_transfer": {
"urgency": "same_day",
"recommended_action": "Surgical clinic visit within 24 hours"
},
"followup_questions": [
"Is there any drainage from the wound? What color?",
"Have you noticed any foul odor?",
"Are you able to keep food down?"
],
"evidence": [
{
"source": "temperature",
"domain": "infection",
"snippet": "Temperature 38.6°C exceeds post-discharge threshold"
}
],
"safety": {
"sepsis_screen": false,
"immediate_911": false
},
"phase1b_compat": {
"red_flag_triggered": true
}
}
from transformers import AutoTokenizer, AutoModelForCausalLM
from peft import PeftModel
import torch
# Load model
base_model = "google/medgemma-27b-text-it"
model = AutoModelForCausalLM.from_pretrained(
base_model,
torch_dtype=torch.bfloat16,
device_map="auto"
)
tokenizer = AutoTokenizer.from_pretrained(base_model)
# Load Phase2 adapter
model = PeftModel.from_pretrained(
model,
"bobby07007/surgicalcopilot-phase2-27b"
)
# System prompt
system_prompt = (
'You are SAFEGUARD, a post-discharge recovery monitoring AI. '
'Output ONLY a single raw JSON object — no markdown, no code fences. '
'The JSON must contain the key "risk_level" with value "green", "amber", or "red".'
)
# Example case
case_text = """
Patient: 45F, POD 7 post laparoscopic appendectomy
Daily Check-in:
Pain: 6/10 (increased from 3/10 yesterday)
Temperature: 38.6°C
Wound: Redness around incision, warmth noted
Nausea: None
Mobility: Limited due to pain
Appetite: Reduced
"""
messages = [
{"role": "system", "content": system_prompt},
{"role": "user", "content": case_text}
]
prompt = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
outputs = model.generate(**inputs, max_new_tokens=1024, do_sample=False)
response = tokenizer.decode(outputs[0][inputs['input_ids'].shape[1]:], skip_special_tokens=True)
print(response)
@misc{surgicalcopilot2026phase2,
title={SurgicalCopilot Phase2: SAFEGUARD Post-Discharge Monitoring},
author={Aayush},
year={2026},
publisher={Hugging Face},
howpublished={\url{https://huggingface.co/bobby07007/surgicalcopilot-phase2-27b}}
}
Apache 2.0
⚠️ DISCLAIMER: Research/demonstration model only. Not for clinical use without validation and oversight.