利用AI满足自己的小爱好

最近在研究HuggingFace,发现了好多有趣的模型,借助其免费的资源可以实现自己画家的小爱好

给出一个例子

1. 铅笔画模型 https://huggingface.co/Datou1111/shou_xin,其可以使用接口进行调用使用手法我这边编写了一个非常简单的脚本

from huggingface_hub import InferenceClient
import os
import uuid
proxy_url = "http://127.0.0.1:7890"

# 设置环境变量以使用代理
os.environ['HTTP_PROXY'] = proxy_url
os.environ['HTTPS_PROXY'] = proxy_url
client = InferenceClient("Datou1111/shou_xin", token="hf_n")
prompts = [ "shou_xin, an office worker sitting at their desk, looking at the computer screen, preparing to stand up, office environment, ink wash painting, minimalistic, impressionism, negative space, focused atmosphere.", "shou_xin, the office worker now standing up from their chair, gathering their belongings, ready to leave, office environment, ink wash, minimalistic, impressionism, negative space, transitional movement.", "shou_xin, the office worker walking out of the office, carrying a bag or briefcase, looking forward, office environment, ink wash, minimalistic, impressionism, negative space, sense of departure." ]
# output is a PIL.Image object
for prompt in prompts:
    image = client.text_to_image(prompt)
    image.save("output_image_" + str(uuid.uuid4()) + ".png")

2. 提示词可以使用其他的AI模型来生成,我是使用的自己写的平台

3. 然后将连续生成的图片在拼接成一幅图,就形成了类似于漫画的图片,当然拼接也是使用我自己的平台

4. 最终生成的效果如下

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值