Spaces:
Running
Running
sarahciston
commited on
Commit
•
6ff171e
1
Parent(s):
95ce7e8
wrap in async function
Browse files
index.js
CHANGED
@@ -3,15 +3,20 @@ import { pipeline, env } from 'https://cdn.jsdelivr.net/npm/@xenova/transformers
|
|
3 |
// skip local model check
|
4 |
env.allowLocalModels = false;
|
5 |
|
6 |
-
|
|
|
7 |
|
8 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
|
10 |
-
|
11 |
-
|
12 |
-
out.forEach(o => {
|
13 |
-
console.log(o) // yields { score, sequence, token, token_str } for each result
|
14 |
-
outputList.push(o.sequence) // put only the full sequence in a list
|
15 |
-
})
|
16 |
-
|
17 |
-
console.log(outputList)
|
|
|
3 |
// skip local model check
|
4 |
env.allowLocalModels = false;
|
5 |
|
6 |
+
var PROMPT_INPUT = `The pickle has a job as a [MASK] and feels so-so about it.`
|
7 |
+
var OUTPUT_LIST = []
|
8 |
|
9 |
+
async function fillIn(){
|
10 |
+
const fillInTask = await pipeline('fill-mask', 'Xenova/bert-base-uncased');
|
11 |
+
|
12 |
+
var out = await fillInTask(PROMPT_INPUT);
|
13 |
+
|
14 |
+
await out.forEach(o => {
|
15 |
+
console.log(o) // yields { score, sequence, token, token_str } for each result
|
16 |
+
OUTPUT_LIST.push(o.sequence) // put only the full sequence in a list
|
17 |
+
})
|
18 |
+
|
19 |
+
console.log(OUTPUT_LIST)
|
20 |
|
21 |
+
return await OUTPUT_LIST
|
22 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|