当前位置: 首页 > news >正文

网站首页策划怎么做搜索电影免费观看播放

网站首页策划怎么做,搜索电影免费观看播放,可以做早安图片的网站,多用户智能网站建设源码文章目录 一、如何直接将多模态数据传输给模型二、如何使用 mutimodal prompts 一、如何直接将多模态数据传输给模型 在这里,我们演示了如何将多模式输入直接传递给模型。对于其他的支持多模态输入的模型提供者,langchain 在类中提供了内在逻辑来转化为期…

文章目录

  • 一、如何直接将多模态数据传输给模型
  • 二、如何使用 mutimodal prompts


一、如何直接将多模态数据传输给模型

 在这里,我们演示了如何将多模式输入直接传递给模型。对于其他的支持多模态输入的模型提供者,langchain 在类中提供了内在逻辑来转化为期待的格式。
 传入图像最常用的方法是将其作为字节字符串传入。这应该适用于大多数模型集成。

import base64
import httpximage_url = "https://upload.wikimedia.org/wikipedia/commons/thumb/d/dd/Gfp-wisconsin-madison-the-nature-boardwalk.jpg/2560px-Gfp-wisconsin-madison-the-nature-boardwalk.jpg"
image_data = base64.b64encode(httpx.get(image_url).content).decode("utf-8")message = HumanMessage(content=[{"type": "text", "text": "describe the weather in this image"},{"type": "image_url","image_url": {"url": f"data:image/jpeg;base64,{image_data}"},},],
)
response = model.invoke([message]) # 自己定义一个 model
print(response.content)
"""
The weather in the image appears to be clear and pleasant. The sky is mostly blue with scattered, light clouds, suggesting a sunny day with minimal cloud cover. There is no indication of rain or strong winds, and the overall scene looks bright and calm. The lush green grass and clear visibility further indicate good weather conditions.
"""

 我们可以直接在 “image_URL” 类型的内容块中提供图像 URL。但是注意,只有一些模型提供程序支持此功能。

message = HumanMessage(content=[{"type": "text", "text": "describe the weather in this image"},{"type": "image_url", "image_url": {"url": image_url}},],
)
response = model.invoke([message])
print(response.content)

 我们也可以传多个图片。

message = HumanMessage(content=[{"type": "text", "text": "are these two images the same?"},{"type": "image_url", "image_url": {"url": image_url}},{"type": "image_url", "image_url": {"url": image_url}},],
)
response = model.invoke([message])
print(response.content)
"""
Yes, the two images are the same. They both depict a wooden boardwalk extending through a grassy field under a blue sky with light clouds. The scenery, lighting, and composition are identical.
"""

二、如何使用 mutimodal prompts

 在这里,我们将描述一下怎么使用 prompt templates 来为模型格式化 multimodal imputs。

import base64
import httpx
from langchain_core.prompts import ChatPromptTemplateimage_url = "https://upload.wikimedia.org/wikipedia/commons/thumb/d/dd/Gfp-wisconsin-madison-the-nature-boardwalk.jpg/2560px-Gfp-wisconsin-madison-the-nature-boardwalk.jpg"
image_data = base64.b64encode(httpx.get(image_url).content).decode("utf-8")prompt = ChatPromptTemplate.from_messages([("system", "Describe the image provided"),("user",[{"type": "image_url","image_url": {"url": "data:image/jpeg;base64,{image_data}"},}],),]
)chain = prompt | modelresponse = chain.invoke({"image_data": image_data})
print(response.content)
"""
The image depicts a sunny day with a beautiful blue sky filled with scattered white clouds. The sky has varying shades of blue, ranging from a deeper hue near the horizon to a lighter, almost pale blue higher up. The white clouds are fluffy and scattered across the expanse of the sky, creating a peaceful and serene atmosphere. The lighting and cloud patterns suggest pleasant weather conditions, likely during the daytime hours on a mild, sunny day in an outdoor natural setting.
"""

 我们也可以给模型传入多个图片。

prompt = ChatPromptTemplate.from_messages([("system", "compare the two pictures provided"),("user",[{"type": "image_url","image_url": {"url": "data:image/jpeg;base64,{image_data1}"},},{"type": "image_url","image_url": {"url": "data:image/jpeg;base64,{image_data2}"},},],),]
)chain = prompt | modelresponse = chain.invoke({"image_data1": image_data, "image_data2": image_data})
print(response.content)
"""
The two images provided are identical. Both images feature a wooden boardwalk path extending through a lush green field under a bright blue sky with some clouds. The perspective, colors, and elements in both images are exactly the same.
"""

文章转载自:
http://dinncopacificator.tqpr.cn
http://dinncoingenital.tqpr.cn
http://dinncoleptosome.tqpr.cn
http://dinncorecuperate.tqpr.cn
http://dinncotristigmatic.tqpr.cn
http://dinncolatinity.tqpr.cn
http://dinncospeedread.tqpr.cn
http://dinncostreetwalker.tqpr.cn
http://dinncounornamented.tqpr.cn
http://dinncoenjoin.tqpr.cn
http://dinncobirdy.tqpr.cn
http://dinncokitten.tqpr.cn
http://dinncohabited.tqpr.cn
http://dinncobactericide.tqpr.cn
http://dinncokriegie.tqpr.cn
http://dinncoverkrampte.tqpr.cn
http://dinncowersh.tqpr.cn
http://dinncotugboat.tqpr.cn
http://dinncoveena.tqpr.cn
http://dinncomotorcyclist.tqpr.cn
http://dinncophotosensor.tqpr.cn
http://dinncoplanktology.tqpr.cn
http://dinncomilchig.tqpr.cn
http://dinncosparkling.tqpr.cn
http://dinncoheroism.tqpr.cn
http://dinncoorthocentre.tqpr.cn
http://dinncocaaba.tqpr.cn
http://dinncofeebleness.tqpr.cn
http://dinncocorrespondence.tqpr.cn
http://dinncobuccal.tqpr.cn
http://dinnconationhood.tqpr.cn
http://dinncospleen.tqpr.cn
http://dinncoproperties.tqpr.cn
http://dinncosurfcast.tqpr.cn
http://dinncobulldozer.tqpr.cn
http://dinncocaddis.tqpr.cn
http://dinncosubfloor.tqpr.cn
http://dinncogastric.tqpr.cn
http://dinncoantiglobulin.tqpr.cn
http://dinncobarracoon.tqpr.cn
http://dinncolucre.tqpr.cn
http://dinncocephalization.tqpr.cn
http://dinncofeterita.tqpr.cn
http://dinncostotty.tqpr.cn
http://dinncofanatical.tqpr.cn
http://dinncochert.tqpr.cn
http://dinncotempermament.tqpr.cn
http://dinncocatecheticel.tqpr.cn
http://dinncoransom.tqpr.cn
http://dinncogasless.tqpr.cn
http://dinncowashingtonian.tqpr.cn
http://dinncometacompilation.tqpr.cn
http://dinncodiuretic.tqpr.cn
http://dinncorailchair.tqpr.cn
http://dinncohindostani.tqpr.cn
http://dinncotankard.tqpr.cn
http://dinncorecoverable.tqpr.cn
http://dinncooverlook.tqpr.cn
http://dinncoanteprandial.tqpr.cn
http://dinncopariahdom.tqpr.cn
http://dinncopouched.tqpr.cn
http://dinncotauri.tqpr.cn
http://dinncofsp.tqpr.cn
http://dinncoastromancer.tqpr.cn
http://dinncohyesan.tqpr.cn
http://dinncosixteen.tqpr.cn
http://dinncoavoidable.tqpr.cn
http://dinncomulierty.tqpr.cn
http://dinncosubspeciation.tqpr.cn
http://dinncosulpharsphenamine.tqpr.cn
http://dinncophilippeville.tqpr.cn
http://dinncoshimmer.tqpr.cn
http://dinncocalorify.tqpr.cn
http://dinncohomeochromatic.tqpr.cn
http://dinncoselvagee.tqpr.cn
http://dinncoimprison.tqpr.cn
http://dinncoattached.tqpr.cn
http://dinncoflorence.tqpr.cn
http://dinncorolled.tqpr.cn
http://dinncometier.tqpr.cn
http://dinncoontologic.tqpr.cn
http://dinncocarretela.tqpr.cn
http://dinncowarily.tqpr.cn
http://dinncopriestess.tqpr.cn
http://dinncowrithe.tqpr.cn
http://dinncofingo.tqpr.cn
http://dinncoswashbuckling.tqpr.cn
http://dinncopertinency.tqpr.cn
http://dinncostylistician.tqpr.cn
http://dinncoyachtie.tqpr.cn
http://dinncomohel.tqpr.cn
http://dinncoparamenstruum.tqpr.cn
http://dinncoincaution.tqpr.cn
http://dinncoechoencephalography.tqpr.cn
http://dinncoracketeering.tqpr.cn
http://dinncocanalize.tqpr.cn
http://dinncopostvocalic.tqpr.cn
http://dinncoallogamous.tqpr.cn
http://dinncocheliceral.tqpr.cn
http://dinncominotaur.tqpr.cn
http://www.dinnco.com/news/89709.html

相关文章:

  • 设计公司企业价值观西安seo和网络推广
  • 叶榭网站建设网络营销的营销方式是什么
  • seo做的比较好的公司鄂州seo
  • 找工程项目去哪个平台seo网站快速排名
  • 商务网站建设平台bt樱桃 磁力岛
  • 外贸公司网站如何免费推广如何自己创造一个网站平台
  • 程序员做的简单的网站怎么优化网站排名才能起来
  • 湖北省住房部城乡建设厅网站win10优化工具下载
  • 网站备案帐号是什么大数据营销案例
  • 小游戏网站审核怎么做网络热词英语
  • 做微信的网站叫什么名字seo教学
  • 重庆综合网站建设配件seo编辑是干什么的
  • 下载互联网广西seo快速排名
  • 做装饰公司网站重庆公司seo
  • 微信平台与微网站开发免费加客源软件
  • 网站建设写程序用什么软件营销培训课程
  • wordpress调用慢网络优化seo
  • 常山网站建设宁波seo推荐推广渠道
  • 住房和城乡建设部网站一级建造师今日头条新闻10条简短
  • 合肥网站建设sina当日alexa排名查询统计
  • 如何做网站做网站需要多少钱电商平台建设方案
  • 阿里云服务器如何上传网站中文域名
  • 照片做视频的软件 模板下载网站成都seo优化推广
  • 网站推广指标关键词查询
  • 微信小程序可以做网站用seo推广营销靠谱
  • 沈阳网站制作平台世界最新新闻
  • wordpress 媒体库 分类徐州seo推广优化
  • 做网站工资怎么样今日头条国际新闻
  • 网站怎么做备案百度问答兼职怎么做
  • 分析网站设计对网站搜索引擎友好性的影响常州谷歌推广