- リンクを取得
- メール
- 他のアプリ
StableDiffusionが世を賑わかせているので、便乗してニュースのテキストから画像を生成し、TTSの音声と併せて動画にしてみた。 まずは画像生成用のモジュールから。 ! pip install accelerate diffusers transformers scipy ftfy # make sure you're logged in with `huggingface-cli login` from torch import autocast from diffusers import StableDiffusionPipeline import gc SDpipe = StableDiffusionPipeline.from_pretrained ( "stabilityai/stable-diffusion-2" , use_auth_token= "enter your token" ) .to ( "cuda" ) def getImgFromPrompt ( prompt , imgName ) : gc.collect ( generation= 0 ) gc.collect ( generation= 1 ) gc.collect ( generation= 2 ) image = SDpipe ( prompt , height= 512 , width= 512 ) .images [ 0 ] display ( image ) image.save ( imgName ) 上記で以下のpromptを入れてみた。 Exclusive: JPMorgan looking to finance Italy's Serie A for up to 1 billion euros | Reuters Sassuolo v AC Milan - Mapei Stadium - Citta del Tricolore, Reggio Emilia, Italy - May 22, 2022 AC Milan's Alessio Romagnoli lifts the tro