File size: 700 Bytes
4189f9e
 
8993dbb
4189f9e
 
6ff171e
 
4189f9e
6ff171e
 
 
 
855a94a
 
6ff171e
855a94a
 
 
 
6ff171e
855a94a
4189f9e
855a94a
6ff171e
855a94a
 
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
import { pipeline, env } from 'https://cdn.jsdelivr.net/npm/@xenova/[email protected]';

// skip local model check
env.allowLocalModels = false;

var PROMPT_INPUT = `The pickle has a job as a [MASK] and feels so-so about it.`
var OUTPUT_LIST = []

async function fillIn(){
  const fillInTask = await pipeline('fill-mask', 'Xenova/bert-base-uncased');
  
  var out = await fillInTask(PROMPT_INPUT);

  console.log(await out)
  
  // await out.forEach(o => {
  //   console.log(o) // yields { score, sequence, token, token_str } for each result
  //   OUTPUT_LIST.push(o.sequence) // put only the full sequence in a list
  // })
  
  // console.log(OUTPUT_LIST)

  return await out
}

await fillIn()