Spaces:
Sleeping

Grp2_CardioLens / README.md
ftmhr's picture
Upload 5 files
e4bd789 verified
|
Raw History Blame Contribute Delete
4.97 kB

A newer version of the Gradio SDK is available: 6.32.0

Upgrade
metadata
title: CardioLens ECG Detective
sdk: gradio
sdk_version: 5.49.1
python_version: '3.11'
app_file: app.py

CardioLens ECG Detective

Interface: original CardioLens Gradio layout and controls by member 3, integrated with the ECG model and evidence functions.

Academic demonstration. Use the included project ECGs and fictional history.

  1. Examine: the original CPU waveform CNN predicts rhythm labels. On three included demonstrations only, the frozen Qwen FAST/SLOW adapter reads the same lead-II image used in validation. XQRS candidate detections from lead II and a second lead (V2 first, with V1, I or V5 as fallback) are checked for agreement, then shown on a separate plot with four numbered consecutive gaps. These candidate locations and timing estimates are not a validated ECG measurement or signal-quality test.
  2. Explain: ask where the timing evidence appears, what a label means, or whether the models agree. Clinical Detective chooses a follow-up from fixed questions using the case history. The app supplies the factual response from recorded results and user history.
  3. Report: candidate beat timing, restricted image result, model-suggested rhythm, user-reported history and limitations. The report is assembled from the active case; no findings are generated from scratch.

The three cases deliberately include two earlier correct visual predictions and one error. They illustrate behaviour, not a new accuracy estimate. The FAST/SLOW adapter got 56/64 correct on a balanced, selected development panel. It does not classify normal-rate recordings, AFIB or other rhythms, and is not run on arbitrary uploads. The CNN has a separate 12-label task. No photo digitization, PR/QT measurements, or general ECG diagnosis is supported.

Clinical Detective review

The app chooses an ECG review priority based on missing timing, disagreement, or the CNN's rhythm suggestions. Follow-up questions depend on the case. Explicit answers about movement, rest/activity, or symptoms during the recording can change the next review step. Free text stays in the history and can inform question selection. These suggestions are for reviewing the existing ECG.

Educational ECG references: ESC supraventricular tachycardia guideline and ACC/AHA atrial fibrillation guideline.

Reading the output

The default chat starts with the rhythm suggestion, estimated rate and one case-specific review step. ECG evidence contains the plotted gaps and technical model details. The report is an editable review draft: recording, reported clinical context, measured findings, impression and next review step. A relevant disagreement is included; demo-only model status and calibration notes stay in ECG evidence.

Showcase checklist

  • Choose a demo from Previous cases, click Analyse ECG, and open ECG evidence. Check that the numbered gaps match the trace.
  • In Clinical Detective, answer one follow-up with fictional history. Ask what you said and where the timing estimate came from.
  • Generate the report. Check that timing, image output, CNN suggestion and history are separate.
  • Click + to start a new case and check that the old conversation clears. On a waveform upload, confirm the image model is not applied.
  • Treat a FAST/SLOW mismatch as a finding to review, not a diagnosis. The QRS extension is not included.

Running

Use a compatible CUDA GPU for the visual model. Install requirements, then run python app.py or use the Gradio Space configuration above. The pinned base weights are downloaded on first use. The CPU CNN and template flow can run without CUDA, but that does not demonstrate the image task. Test the actual hosting environment before the showcase. No Space has been published by this package.

Sources

  • Wagner, Strodthoff, Bousseljot, Samek, and Schaeffter (2022), PTB-XL v1.0.3, PhysioNet, DOI 10.13026/kfzx-aw45, CC BY 4.0. The included records are prepared 100 Hz waveforms and rendered lead-II plots. Keep the dataset attribution and licence.
  • Qwen2.5-VL-3B-Instruct: base revision is in demo_manifest.json. Review the upstream licence before publishing.
  • WFDB XQRS candidate beat detector.

Lead-II QRS duration estimate

Analysis automatically estimates candidate lead-II boundaries and durations. Ask the Detective about a span or the median duration. The model is unchanged from the LUDB training and PTB-XL transfer experiments. PTB-XL duration agreement within 20 ms of ECGDeli was 70.9%; agreement was lower for longer estimates. No wide-QRS flag, clinical measurement, or change to the rhythm classifier.