Beeniebeen commited on
Commit
389e9c8
1 Parent(s): a93bcf0

Create deberta.js

Browse files
Files changed (1) hide show
  1. deberta.js +16 -0
deberta.js ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // To demonstrate use of Javascript promise in Transformers.js pipeline API
2
+ // Import the library
3
+ import { pipeline } from 'https://cdn.jsdelivr.net/npm/@xenova/transformers@2.5.4';
4
+ // Make it available globally
5
+ window.pipeline = pipeline;
6
+
7
+ async function makepipe() {
8
+ return await pipeline('sentiment-analysis');
9
+ }
10
+
11
+ async function main() {
12
+ let pipe = await makepipe();
13
+ let out = await pipe('I love transformers!');
14
+ console.log(out);
15
+ }
16
+ main(); // cannot manually call main() from a browser console. main() not defined error.