4
4
5
5
use Classifai \Features \AudioTranscriptsGeneration ;
6
6
use Classifai \Features \Classification ;
7
+ use Classifai \Features \DescriptiveTextGenerator ;
7
8
use Classifai \Features \ExcerptGeneration ;
8
9
use Classifai \Features \ImageCropping ;
9
10
use Classifai \Features \TextToSpeech ;
@@ -788,8 +789,7 @@ public function image( $args = [], $opts = [] ) {
788
789
$ attachment_ids = $ this ->get_attachment_to_classify ( $ opts );
789
790
}
790
791
791
- $ total = count ( $ attachment_ids );
792
- $ classifier = new ComputerVision ( false );
792
+ $ total = count ( $ attachment_ids );
793
793
794
794
if ( empty ( $ total ) ) {
795
795
return \WP_CLI ::log ( 'No images to classify. ' );
@@ -812,8 +812,13 @@ public function image( $args = [], $opts = [] ) {
812
812
813
813
$ current_meta = wp_get_attachment_metadata ( $ attachment_id );
814
814
\WP_CLI ::line ( 'Processing ' . $ attachment_id );
815
- $ classifier ->generate_image_alt_tags ( $ current_meta , $ attachment_id );
816
- $ classifier ->smart_crop_image ( $ current_meta , $ attachment_id );
815
+ $ feature = new DescriptiveTextGenerator ();
816
+ $ result = $ feature ->run ( $ attachment_id , 'descriptive_text ' );
817
+ $ feature ->save ( $ result , $ attachment_id );
818
+
819
+ $ feature = new ImageCropping ();
820
+ $ result = $ feature ->run ( $ attachment_id , 'crop ' );
821
+ $ feature ->save ( $ result , $ attachment_id );
817
822
}
818
823
819
824
$ progress_bar ->finish ();
0 commit comments