Spaces:
Running
Running
Update index.js
Browse files
index.js
CHANGED
@@ -2,6 +2,7 @@ import { pipeline } from 'https://cdn.jsdelivr.net/npm/@huggingface/transformers
|
|
2 |
|
3 |
// Reference the elements that we will need
|
4 |
const status = document.getElementById('status');
|
|
|
5 |
const inputSubmitBtn = document.getElementById('submit');
|
6 |
|
7 |
// Create a new object detection pipeline
|
@@ -9,6 +10,17 @@ status.textContent = 'Loading model...';
|
|
9 |
const detector = await pipeline('token-classification', 'Setosm/bert-finetuned-for-medical-ner');
|
10 |
status.textContent = 'Ready';
|
11 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
// example.addEventListener('click', (e) => {
|
13 |
// e.preventDefault();
|
14 |
// detect(EXAMPLE_URL);
|
|
|
2 |
|
3 |
// Reference the elements that we will need
|
4 |
const status = document.getElementById('status');
|
5 |
+
const inputText = document.getElementById('text-field');
|
6 |
const inputSubmitBtn = document.getElementById('submit');
|
7 |
|
8 |
// Create a new object detection pipeline
|
|
|
10 |
const detector = await pipeline('token-classification', 'Setosm/bert-finetuned-for-medical-ner');
|
11 |
status.textContent = 'Ready';
|
12 |
|
13 |
+
inputSubmitBtn.addEventListener('click', async (e) => {
|
14 |
+
e.preventDefault();
|
15 |
+
let classifier = await pipeline('token-classification');
|
16 |
+
let result = await classifier(inputText.value);
|
17 |
+
showOutput();
|
18 |
+
});
|
19 |
+
|
20 |
+
function showOutput() {
|
21 |
+
|
22 |
+
}
|
23 |
+
|
24 |
// example.addEventListener('click', (e) => {
|
25 |
// e.preventDefault();
|
26 |
// detect(EXAMPLE_URL);
|