Views
No views yet
[!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.
1{
2 "r": 16,
3 "lora_alpha": 32,
4 "lora_dropout": 0.05,
5 "bias": "none",
6 "task_type": "CAUSAL_LM",
7 "target_modules": [
8 "q_proj", "k_proj", "v_proj", "o_proj",
9 "gate_proj", "up_proj", "down_proj"
10 ]
11}| 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% |
1{
2 "doc_type": "safeguard_assessment",
3 "risk_level": "RED",
4 "risk_score": 0.87,
5 "timeline_deviation": "behind_expected",
6 "trajectory": "deteriorating",
7 "trigger_reason": "Surgical site infection suspected",
8 "domain_flags": {
9 "wound": "moderate",
10 "pain": "severe",
11 "mobility": "impaired",
12 "gi": "normal",
13 "respiratory": "normal"
14 },
15 "patient_message": {
16 "summary": "Your wound shows signs that need evaluation. Please contact your surgeon today.",
17 "self_care": [
18 "Take temperature every 4 hours",
19 "Keep wound clean and dry",
20 "Do not apply any creams"
21 ],
22 "next_checkin": "12 hours or if symptoms worsen"
23 },
24 "copilot_transfer": {
25 "urgency": "same_day",
26 "recommended_action": "Surgical clinic visit within 24 hours"
27 },
28 "followup_questions": [
29 "Is there any drainage from the wound? What color?",
30 "Have you noticed any foul odor?",
31 "Are you able to keep food down?"
32 ],
33 "evidence": [
34 {
35 "source": "temperature",
36 "domain": "infection",
37 "snippet": "Temperature 38.6°C exceeds post-discharge threshold"
38 }
39 ],
40 "safety": {
41 "sepsis_screen": false,
42 "immediate_911": false
43 },
44 "phase1b_compat": {
45 "red_flag_triggered": true
46 }
47}1from transformers import AutoTokenizer, AutoModelForCausalLM
2from peft import PeftModel
3import torch
4
5# Load model
6base_model = "google/medgemma-27b-text-it"
7model = AutoModelForCausalLM.from_pretrained(
8 base_model,
9 torch_dtype=torch.bfloat16,
10 device_map="auto"
11)
12tokenizer = AutoTokenizer.from_pretrained(base_model)
13
14# Load Phase2 adapter
15model = PeftModel.from_pretrained(
16 model,
17 "bobby07007/surgicalcopilot-phase2-27b"
18)
19
20# System prompt
21system_prompt = (
22 'You are SAFEGUARD, a post-discharge recovery monitoring AI. '
23 'Output ONLY a single raw JSON object — no markdown, no code fences. '
24 'The JSON must contain the key "risk_level" with value "green", "amber", or "red".'
25)
26
27# Example case
28case_text = """
29Patient: 45F, POD 7 post laparoscopic appendectomy
30Daily Check-in:
31 Pain: 6/10 (increased from 3/10 yesterday)
32 Temperature: 38.6°C
33 Wound: Redness around incision, warmth noted
34 Nausea: None
35 Mobility: Limited due to pain
36 Appetite: Reduced
37"""
38
39messages = [
40 {"role": "system", "content": system_prompt},
41 {"role": "user", "content": case_text}
42]
43
44prompt = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
45inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
46
47outputs = model.generate(**inputs, max_new_tokens=1024, do_sample=False)
48response = tokenizer.decode(outputs[0][inputs['input_ids'].shape[1]:], skip_special_tokens=True)
49print(response)1@misc{surgicalcopilot2026phase2,
2 title={SurgicalCopilot Phase2: SAFEGUARD Post-Discharge Monitoring},
3 author={Aayush},
4 year={2026},
5 publisher={Hugging Face},
6 howpublished={\url{https://huggingface.co/bobby07007/surgicalcopilot-phase2-27b}}
7}