@@ -48,35 +48,35 @@ describe('imageClassifier', () => {
48
48
expect ( classifier . ready ) . toBeTruthy ( ) ;
49
49
} ) ;
50
50
51
- describe ( 'predict ' , ( ) => {
51
+ describe ( 'classify ' , ( ) => {
52
52
it ( 'Should classify an image of a Robin' , async ( ) => {
53
53
const img = await getImage ( ) ;
54
- await classifier . predict ( img )
55
- . then ( results => expect ( results [ 0 ] . className ) . toBe ( 'robin, American robin, Turdus migratorius' ) ) ;
54
+ await classifier . classify ( img )
55
+ . then ( results => expect ( results [ 0 ] . label ) . toBe ( 'robin, American robin, Turdus migratorius' ) ) ;
56
56
} ) ;
57
57
58
58
it ( 'Should support p5 elements with an image on .elt' , async ( ) => {
59
59
const img = await getImage ( ) ;
60
- await classifier . predict ( { elt : img } )
61
- . then ( results => expect ( results [ 0 ] . className ) . toBe ( 'robin, American robin, Turdus migratorius' ) ) ;
60
+ await classifier . classify ( { elt : img } )
61
+ . then ( results => expect ( results [ 0 ] . label ) . toBe ( 'robin, American robin, Turdus migratorius' ) ) ;
62
62
} ) ;
63
63
64
64
it ( 'Should support HTMLCanvasElement' , async ( ) => {
65
65
const canvas = await getCanvas ( ) ;
66
- await classifier . predict ( canvas )
67
- . then ( results => expect ( results [ 0 ] . className ) . toBe ( 'robin, American robin, Turdus migratorius' ) ) ;
66
+ await classifier . classify ( canvas )
67
+ . then ( results => expect ( results [ 0 ] . label ) . toBe ( 'robin, American robin, Turdus migratorius' ) ) ;
68
68
} ) ;
69
69
70
70
it ( 'Should support p5 elements with canvas on .canvas' , async ( ) => {
71
71
const canvas = await getCanvas ( ) ;
72
- await classifier . predict ( { canvas } )
73
- . then ( results => expect ( results [ 0 ] . className ) . toBe ( 'robin, American robin, Turdus migratorius' ) ) ;
72
+ await classifier . classify ( { canvas } )
73
+ . then ( results => expect ( results [ 0 ] . label ) . toBe ( 'robin, American robin, Turdus migratorius' ) ) ;
74
74
} ) ;
75
75
76
76
it ( 'Should support p5 elements with canvas on .elt' , async ( ) => {
77
77
const canvas = await getCanvas ( ) ;
78
- await classifier . predict ( { elt : canvas } )
79
- . then ( results => expect ( results [ 0 ] . className ) . toBe ( 'robin, American robin, Turdus migratorius' ) ) ;
78
+ await classifier . classify ( { elt : canvas } )
79
+ . then ( results => expect ( results [ 0 ] . label ) . toBe ( 'robin, American robin, Turdus migratorius' ) ) ;
80
80
} ) ;
81
81
} ) ;
82
82
} ) ;
0 commit comments