mac OS飞桨环境搭建-玩PaddleHub大模型

PaddleHub:使用文心大模型ERNIE-ViLG进行高质量文图生成 - 飞桨AI Studio

我安装的时候在 opencv-python 卡住了,换了源就过去了:

-i https://pypi.tuna.tsinghua.edu.cn/simple:

pip install --upgrade paddlehub -i https://pypi.tuna.tsinghua.edu.cn/simple

pip install docarray

import paddlehub as hub

from docarray import DocumentArray, Document

ernie_vilg_module = hub.Module(name='ernie_vilg')

函数定义描述:

def generate_image(

        text_prompts: str,

        style: Optional[str] = "油画",

        topk: Optional[int] = 2,

        output_dir: Optional[str] = 'ernievilg_output')

参数描述:

  • text_prompts(str): 输入的语句,描述想要生成的图像的内容。
  • style(Optional[str]): 生成图像的风格,当前支持'油画','水彩','粉笔画','卡通','儿童画','蜡笔画'。
  • topk(Optional[int]): 保存前多少张图,最多保存10张。
  • output_dir(Optional[str]): 保存输出图像的目录,默认为"ernievilg_output"。

应用:

python 

import paddlehub as hub

from docarray import DocumentArray, Document

ernie_vilg_module = hub.Module(name='ernie_vilg')

results = ernie_vilg_module.generate_image(text_prompts="早上的阳光懒懒的照在身上", style="油画", output_dir='/Users/manzhou/Downloads/paddleoutput')

应用2(提示异常):

import paddlehub as hub

from docarray import DocumentArray, Document

ernie_vilg_module = hub.Module(name='ernie_vilg')

results = ernie_vilg_module.generate_image(text_prompts="早上的阳光懒懒的照在身上", style="油画", topk=2, output_dir='/Users/manzhou/Downloads/paddleoutput')

展示下结果 : 

  • 2
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 6
    评论
评论 6
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

爬上树顶

打赏可验证我能否靠此文财务自由

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值