程序员开发实例大全宝库

网站首页 > 编程文章 正文

StoryDiffusion 一键生成长篇故事,漫画,写实等多种风格任选!

zazugpt 2024-10-10 14:33:53 编程文章 47 ℃ 0 评论

今天给大家分享的一个项目是,如何在本地部署一款使用AI来制作漫画的应用程序?即使你的设备断开网络连接,你也同样能够使用这个项目来生成你想要生成的漫画。而你只需要做的只是在提示词输入区输入必要的提示词,按下生成按钮即可生成漫画。下面让我们看看使用StorryDiffusion生成漫画吧:

生成这副漫画用到的提示词为:

[Max] at home, seeing a map on the table pointing to a mysterious island.
[Max] is packing his backpack, ready to set out.
[Lily] on the phone, [Max] invites her to join him on an adventure.
[Max] and [Lily] at the seaside, preparing to board a boat.
[NC] Their boat in the ocean, with light clouds drifting in the sky.
[Max] and [Lily] landing on the beach of the island.
[NC] In the island's jungle, a monkey watches them from a tree.
[Max] and [Lily] exploring the jungle with a map in hand.
[NC] At night, by the campfire in their camp, they plan the route for the next day.
[Max] slips during the adventure, with a look of surprise.
[Lily] helps [Max] to stand up, both smiling at each other.
[NC] Deep in the jungle, they discover a forgotten stone building.
[Max] and [Lily] rush into the building, finding a room filled with antiques and treasures.
[Max] and [Lily] excitedly embrace in the treasure room.
[NC] At night, they celebrate by the campfire under a sky full of stars.

很显然,上面这副漫画是日本风格的漫画,我们可以切换为摄影风格的漫画,

用到的提示词依旧是上文提供的那些,下面我们看看迪士尼风格的漫画是什么样的,

除了刚才演示的这三种风格的漫画外,还有油画风格漫画书风格线条漫画风格黑白电影风格等多种类型,在文章的结尾时,将会为大家提供此AI项目的一键运行包。在你获取到这整合包后,只需双击”go.exe“这个可执行程序,此项目可以在你电脑本地快速运行,而不需要下载任何依赖包和大模型,断开网络的条件下依旧可以运行。

不过,如果你想从头到尾在你本地电脑上部署这款应用,那么这里我建议你继续往下阅读。

首先storryDiffusion这个AI项目地址为”https://github.com/HVision-NKU/StoryDiffusion

部署准备:

1、正式在你本地电脑上部署这款应用之前,请确保你的设备能够连接访问huggingface网站,

2、安装python环境,

python的下载地址为:

https://www.python.org/ftp/python/3.10.9/python-3.10.9-amd64.exe

3、安装git环境

Git安装包下载地址为:

https://github.com/git-for-windows/git/releases/download/v2.45.1.windows.1/Git-2.45.1-64-bit.exe

4、确保你的电脑要有一张显存不少于8GB的N卡。


开始部署:

1、将storryDiffusion源代码克隆到本后,进入项目

git clone https://github.com/Langjudy/StoryDiffusion.git   && cd StoryDiffusion

2、在终端继续输入下面的指令创建并激活一个虚拟环境:

python -m venv venv && .\venv\Scripts\activate

3、安装项目依赖

pip install -r requirements.txt

4、安装pytorch

上述第三条指令安装的依赖包中,torch为CPU版本,无法调用GPU来加速计算,为此,需要将此cpu版本的torch卸载,然后安装GPU版本的torch

pip uninstall torch && pip install torch==2.0.1 -f https://download.pytorch.org/whl/torch_stable.html

5、启动项目,在运行项目后,程序会自动到huggingface网站上下载所需的模型,这个过程中,请务必做好代理上网的准备,否则无法将模型下载到本地:

python gradio_app_sdxl_specific_id_low_vram.py

如果在运行程序过程中出现了gbk编码错误,

这说明需要将gradio升级到最新版本,可用下面的指令来完成:

pip install --upgrade  gradio

这样程序再次运行程序后,将不会出现问题!

直到最后,你将看到以下内容

这里的地址”0.0.0.0:7860“表示项目地址,打开你的浏览器,输入以下网址:”http://127.0.0.1:7860“,你便可以在本地电脑上能使用StorryDiffusion这个AI项目了,

除此之外,你如果想让你的好朋友也来使用这个漫画自动生成工具,那么你可以将上图第二个链接地址

https://5e51c0ff388866e49e.gradio.live

复制下来,然后发送给你的好朋友们了,这样,只要你的项目不关闭,那么你的朋友们便可以正常使用这个项目!

关注微信公众号"无线理论",并回复关键词“友谊万岁”,就可以获得StorryDiffusion一键整合包!!

Tags:

本文暂时没有评论,来添加一个吧(●'◡'●)

欢迎 发表评论:

最近发表
标签列表