Update app.py
Browse files
app.py
CHANGED
@@ -115,51 +115,41 @@ def analyze_ecg_image(image):
|
|
115 |
|
116 |
# Create prompt for GPT-4.1
|
117 |
vision_prompt = f"""Analyze this ECG image carefully. You are a cardiologist analyzing an electrocardiogram (ECG).
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
- Heart rate
|
123 |
-
-
|
124 |
-
-
|
125 |
-
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
- T Waves characteristics
|
131 |
-
- Any other measurements or values visible on the ECG
|
132 |
-
|
133 |
-
Report exact numerical values where visible. If a range is shown, report the range.
|
134 |
-
|
135 |
-
Format your response strictly like this example:
|
136 |
<h3>ECG Report</h3>
|
137 |
<ul>
|
138 |
<li><strong>Analysis Time:</strong> {timestamp}</li>
|
139 |
-
|
140 |
-
|
141 |
-
<li><strong>
|
142 |
-
|
143 |
-
|
144 |
-
<li><strong>Axis:</strong> [description] (or 'Not determinable from image')</li>
|
145 |
-
<li><strong>P Waves:</strong> [description of what's visible]</li>
|
146 |
-
<li><strong>ST Segment:</strong> [description of what's visible]</li>
|
147 |
-
<li><strong>T Waves:</strong> [description of what's visible]</li>
|
148 |
-
<!-- Add other relevant findings visible in the image -->
|
149 |
</ul>
|
150 |
-
<h3>
|
151 |
<ul>
|
152 |
-
<li>[Only observations
|
153 |
-
<li>[
|
154 |
</ul>
|
155 |
-
<h3>
|
156 |
-
<p>[
|
157 |
-
|
158 |
-
|
159 |
-
-
|
160 |
-
- Do NOT
|
161 |
-
-
|
162 |
-
-
|
|
|
163 |
"""
|
164 |
|
165 |
# Generate content using GPT-4.1
|
|
|
115 |
|
116 |
# Create prompt for GPT-4.1
|
117 |
vision_prompt = f"""Analyze this ECG image carefully. You are a cardiologist analyzing an electrocardiogram (ECG).
|
118 |
+
|
119 |
+
IMPORTANT: Only report what you can actually see clearly displayed in this specific ECG screen. Do not include any measurements or values that are not visible or not displayed digitally in the image. Only create sections for values that are actually shown in the image.
|
120 |
+
|
121 |
+
Look for and extract visible measurements from the ECG display, which may include:
|
122 |
+
- Heart rate (if displayed digitally)
|
123 |
+
- Any numeric measurements shown on the screen
|
124 |
+
- Visible rhythm patterns
|
125 |
+
- Any clearly labeled values or measurements
|
126 |
+
|
127 |
+
Report exact numerical values where visible. If a value is not displayed or not visible, DO NOT include that section at all in your response.
|
128 |
+
|
129 |
+
Format your response strictly like this:
|
|
|
|
|
|
|
|
|
|
|
|
|
130 |
<h3>ECG Report</h3>
|
131 |
<ul>
|
132 |
<li><strong>Analysis Time:</strong> {timestamp}</li>
|
133 |
+
<!-- Only include the following if they are visible in the image -->
|
134 |
+
<!-- If Heart Rate is displayed: -->
|
135 |
+
<li><strong>Heart Rate:</strong> [visible value] bpm</li>
|
136 |
+
<!-- If other measurements are visible: -->
|
137 |
+
<!-- Add only visible measurements as list items -->
|
|
|
|
|
|
|
|
|
|
|
138 |
</ul>
|
139 |
+
<h3>Visible Findings</h3>
|
140 |
<ul>
|
141 |
+
<li>[Only observations of what is actually visible in the waveform]</li>
|
142 |
+
<li>[Only visible abnormalities, if any]</li>
|
143 |
</ul>
|
144 |
+
<h3>Visual Assessment</h3>
|
145 |
+
<p>[Brief summary based ONLY on what is visible in this specific ECG display]</p>
|
146 |
+
|
147 |
+
Critical rules:
|
148 |
+
- Do NOT add sections for measurements not visible in the image
|
149 |
+
- Do NOT write "Not determinable from image" for any parameter
|
150 |
+
- Only include data that you can actually see in this ECG screen
|
151 |
+
- Report only the exact values or descriptions visible in the image
|
152 |
+
- If certain standard ECG parameters are not shown, simply don't include them
|
153 |
"""
|
154 |
|
155 |
# Generate content using GPT-4.1
|