Spaces:
Sleeping
Sleeping
Strengthen ECG prompt to avoid generic refusal outputs
Browse files
app.py
CHANGED
|
@@ -76,8 +76,17 @@ def diagnose_ecg(image: Image.Image = None, temp: float = 0.4, max_tokens: int =
|
|
| 76 |
if image is None:
|
| 77 |
return json.dumps({"error": "No image provided."})
|
| 78 |
|
| 79 |
-
system_prompt =
|
| 80 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 81 |
|
| 82 |
messages = [
|
| 83 |
{"role": "system", "content": system_prompt},
|
|
|
|
| 76 |
if image is None:
|
| 77 |
return json.dumps({"error": "No image provided."})
|
| 78 |
|
| 79 |
+
system_prompt = (
|
| 80 |
+
"You are CardioAI, an ECG interpretation engine. "
|
| 81 |
+
"Always analyze the provided ECG image directly. "
|
| 82 |
+
"Do not provide generic AI disclaimers. "
|
| 83 |
+
"Return concise clinical content only."
|
| 84 |
+
)
|
| 85 |
+
user_prompt = (
|
| 86 |
+
"Interpret this ECG image and return exactly these sections: "
|
| 87 |
+
"1) Impression, 2) Rhythm, 3) Rate, 4) ST-T Findings, 5) Urgency. "
|
| 88 |
+
"If image quality is insufficient, write 'Non-diagnostic ECG image quality' in Impression."
|
| 89 |
+
)
|
| 90 |
|
| 91 |
messages = [
|
| 92 |
{"role": "system", "content": system_prompt},
|