Download deberta.js from MJ106/xformjsA: direct link, hf CLI and curl.
- Browser
- Download file 604 Bytes
-
https://huggingface.co/spaces/MJ106/xformjsA/resolve/main/deberta.js
- Command line
-
hf download hf://spaces/MJ106/xformjsA/deberta.js
-
curl -L -o deberta.js https://huggingface.co/spaces/MJ106/xformjsA/resolve/main/deberta.js
604 Bytes
| // To demonstrate use of Javascript promise in Transformers.js pipeline API | |
| // Import the library | |
| import { pipeline } from 'https://cdn.jsdelivr.net/npm/@xenova/transformers@2.5.4'; | |
| // Make it available globally | |
| window.pipeline = pipeline; | |
| async function makepipe() { | |
| return await pipeline('sentiment-analysis'); | |
| } | |
| async function main() { | |
| let pipe = await makepipe(); | |
| let out = await pipe('I love transformers!'); | |
| console.log(out); | |
| } | |
| main(); // cannot manually call main() from a browser console. main() not defined error. Seems to be attributed to Huggingface's use of container |