Spaces:
Sleeping
Sleeping
File size: 2,401 Bytes
2272891 8ff42c0 2272891 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 | <!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Clinical NER Comparison</title>
<style>
body { font-family: Arial; margin: 20px; }
textarea, input, select { width: 100%; margin: 5px 0; }
button { padding: 10px; margin-top: 10px; }
.box { border: 1px solid #ccc; padding: 10px; margin-top: 10px; }
pre { background: #f5f5f5; padding: 10px; }
</style>
</head>
<body>
<h2>Clinical NER Comparison</h2>
<label>Predefined examples:</label>
<select id="examples">
<option value="">-- select an example --</option>
<option>The patient was diagnosed with depression and started cognitive behavioral therapy.</option>
<option>The clinician noted features of melancholic depression.</option>
<option>The patient has a cold and mild fever.</option>
<option>The room was cold overnight.</option>
</select>
<label>Input text:</label>
<textarea id="text" rows="3"></textarea>
<label>Prototype words (comma-separated):</label>
<input id="prototypes" value="cold, depression, fall, stroke, shock, diabetes, metformin">
<button onclick="runNER()">Execute</button>
<div class="box">
<h3>Pipeline 1 — Fine-tuned Clinical BERT</h3>
<pre id="p1"></pre>
</div>
<div class="box">
<h3>Pipeline 2 — Vanilla BERT + similarity</h3>
<pre id="p2"></pre>
</div>
<div class="box">
<h3>Pipeline 3 — Word2Vec + similarity</h3>
<pre id="p3"></pre>
</div>
<div class="box">
<h3>Log</h3>
<pre id="log"></pre>
</div>
<script>
document.getElementById("examples").addEventListener("change", function() {
document.getElementById("text").value = this.value;
});
async function runNER() {
const text = document.getElementById("text").value;
const prototypes = document.getElementById("prototypes").value.split(",");
document.getElementById("log").textContent = "Calling backend...";
const response = await fetch("/run", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ text, prototypes })
});
const data = await response.json();
document.getElementById("p1").textContent = JSON.stringify(data.pipeline_1, null, 2);
document.getElementById("p2").textContent = JSON.stringify(data.pipeline_2, null, 2);
document.getElementById("p3").textContent = JSON.stringify(data.pipeline_3, null, 2);
document.getElementById("log").textContent = data.log.join("\n");
}
</script>
</body>
</html>
|