Spaces:
Running
Running
| import { pipeline, env } from 'https://cdn.jsdelivr.net/npm/@xenova/transformers@2.10.1'; | |
| // 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() | |