Update README.md
Browse files
README.md
CHANGED
@@ -41,9 +41,9 @@ predicted_id = outputs[0].argmax()
|
|
41 |
<h1>Transformers.js in Browser</h1>
|
42 |
<script type="module">
|
43 |
import { pipeline } from 'https://cdn.jsdelivr.net/npm/@xenova/transformers';
|
44 |
-
//
|
45 |
const classifier = await pipeline('text-classification','xuxiaoda/drug_classification');
|
46 |
-
//
|
47 |
const result = await classifier('What are the drugs for treating high blood pressure?');
|
48 |
console.log(result[0].label);
|
49 |
</script>
|
|
|
41 |
<h1>Transformers.js in Browser</h1>
|
42 |
<script type="module">
|
43 |
import { pipeline } from 'https://cdn.jsdelivr.net/npm/@xenova/transformers';
|
44 |
+
// 创建一个pipeline
|
45 |
const classifier = await pipeline('text-classification','xuxiaoda/drug_classification');
|
46 |
+
// 推理
|
47 |
const result = await classifier('What are the drugs for treating high blood pressure?');
|
48 |
console.log(result[0].label);
|
49 |
</script>
|