DiscoArt 是一个很牛逼的开源模块,它能根据你给定的关键词自动绘画。,绘制过程是完全可见的,你可以在 jupyter 页面上看见这个绘制的过程:,
,开始之前,你要确保Python和pip已经成功安装在电脑上,如果没有,可以访问这篇文章:超详细Python安装指南 进行安装。,(可选1) 如果你用Python的目的是数据分析,可以直接安装Anaconda:Python数据分析与挖掘好帮手—Anaconda,它内置了Python和pip.,(可选2) 此外,推荐大家用VSCode编辑器,它有许多的优点:Python 编程的最好搭档—VSCode 详细指南。,请选择以下任一种方式输入命令安装依赖:,pip install discoart 为了运行 Discoart, 你需要Python 3.7+ 和支持 CUDA 的 PyTorch.,你可以在Jupyter中运行Discoart,这样能方便地实时展示绘制过程:,这样将使用默认的 文本描述 和参数创建图像:,创建出来的就是这个图:,
,Create 支持的所有参数如下:,你可以这么使用参数:,
,如果你不是用jupyter运行的,你也可以看到中间结果,因为最终结果和中间结果都会被创建在当前工作目录下,即,3.显示/保存/加载配置,如果你想知道你当前绘图的配置,有三种方法:,from discoart import show_config,show_config(da) # show the config of the first run show_config(da[3]) # show the config of the fourth run show_config( 'discoart-06030a0198843332edc554ffebfbf288' ) # show the config of the run with a known DocArray ID 要保存 Document/DocumentArray 的配置:,from discoart import save_config,save_config(da, 'my.yml') # save the config of the first run save_config(da[3], 'my.yml') # save the config of the fourth run 从配置中导入:,from discoart import create, load_config,config = load_config('my.yml') create(**config) 此外,你还能直接把配置导出为图像的形式,from discoart.config import save_config_svg,save_config_svg(da) 图片,我们的文章到此就结束啦,如果你喜欢今天的Python 实战教程,请持续关注Python实用宝典。
© 版权声明
文章版权归作者所有,未经允许请勿转载。