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.7% |
| Schema Compliance | 100% |
| Label Accuracy (risk) | 93.2% |
| RECIST Accuracy | 95.1% |
| Macro F1 | 0.94 |
| RED Recall (Recurrence) | 97.1% |
| RED Precision | 95.8% |
1{
2 "doc_type": "oncology_surveillance",
3 "risk_level": "RED",
4 "risk_score": 0.89,
5 "progression_status": "recurrence_suspected",
6 "recist_alignment": "PD",
7 "trigger_reason": "Rising CEA + new liver lesions",
8 "copilot_transfer": {
9 "urgency": "urgent",
10 "recommended_action": "Oncology referral within 48-72 hours",
11 "imaging_recommendation": "Contrast-enhanced CT chest/abdomen/pelvis"
12 },
13 "recommended_actions": [
14 "Urgent oncology consultation",
15 "Repeat tumor markers in 2 weeks",
16 "Consider PET scan for metastatic workup",
17 "Tumor board discussion"
18 ],
19 "clinical_explanation": "Rising CEA from 3.2 to 12.8 over 3 months combined with new hepatic lesions on CT suggests hepatic recurrence. Patient reports new-onset fatigue and weight loss (5kg in 2 months). RECIST criteria consistent with progressive disease.",
20 "safety_flags": {
21 "tumor_marker_doubling_time": "45 days",
22 "symptomatic_progression": true,
23 "new_metastases": true
24 },
25 "phase1b_compat": {
26 "red_flag_triggered": true
27 }
28}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 Onco adapter
15model = PeftModel.from_pretrained(
16 model,
17 "bobby07007/surgicalcopilot-onco-27b"
18)
19
20# System prompt
21system_prompt = (
22 'You are an oncology surveillance AI. Output ONLY a single raw JSON object — '
23 'no markdown, no code fences, no explanation. '
24 'The JSON must contain the key "risk_level" with value "green", "amber", or "red", '
25 'and "recist_alignment" with value "CR", "PR", "SD", or "PD".'
26)
27
28# Example case
29case_text = """
30Patient: 58M, 18 months post right hemicolectomy for stage III colon cancer
31Completed adjuvant FOLFOX (6 months)
32
33Surveillance Labs:
34 CEA: 12.8 ng/mL (baseline 2.1, last visit 8.4)
35
36Imaging (CT Chest/Abdomen/Pelvis):
37 - Two new hypodense lesions in liver (segments 6 and 7), largest 2.3 cm
38 - No evidence of local recurrence at anastomosis
39 - No pulmonary nodules
40 - No lymphadenopathy
41
42Symptoms:
43 - Fatigue, progressive over 2 months
44 - Unintentional weight loss: 5kg in 2 months
45 - No abdominal pain
46 - Bowel function normal
47"""
48
49messages = [
50 {"role": "system", "content": system_prompt},
51 {"role": "user", "content": case_text}
52]
53
54prompt = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
55inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
56
57outputs = model.generate(**inputs, max_new_tokens=1536, do_sample=False)
58response = tokenizer.decode(outputs[0][inputs['input_ids'].shape[1]:], skip_special_tokens=True)
59print(response)1@misc{surgicalcopilot2026onco,
2 title={SurgicalCopilot Onco: Cancer Surveillance with MedGemma},
3 author={Aayush},
4 year={2026},
5 publisher={Hugging Face},
6 howpublished={\url{https://huggingface.co/bobby07007/surgicalcopilot-onco-27b}},
7 note={LoRA adapter for oncology surveillance}
8}