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

购物网站建设款流程百度点击器下载

购物网站建设款流程,百度点击器下载,该企业为暂停开票企业解决方案,乐清网站制作公司ChatGPT Stable Diffusion 百度AI MoviePy 实现文字生成视频,小说转视频,自媒体神器!(一) 前言 最近大模型频出,但是对于我们普通人来说,如何使用这些AI工具来辅助我们的工作呢,或者参与进入我们的生活…

ChatGPT + Stable Diffusion + 百度AI + MoviePy 实现文字生成视频,小说转视频,自媒体神器!(一)

前言

最近大模型频出,但是对于我们普通人来说,如何使用这些AI工具来辅助我们的工作呢,或者参与进入我们的生活,就着现在比较热门的几个AI,写个一个提高生产力工具,现在在逻辑上已经走通了,后面会针对web页面、后台进行优化。

github链接 https://github.com/Anning01/TextCreateVideo

B站教程视频 https://www.bilibili.com/video/BV18M4y1H7XN/

那么从一个用户输入文本到生成视频,我分成了五个步骤来做。
在这里插入图片描述

其中2、3 和 4 没有关系,后期做成异步并行。

第一步、将用户输入的文本进行段落切割。

我这里默认用户输入的为txt文件,也是建议一章一章来,太大并不是不可以执行,只是时间上耗费太多,当然4080用户除外!

from config import file_pathclass Main:def txt_handle(self, filepath):"""txt文件处理:return:"""file = open(file_path + filepath, 'r')content = file.read().replace('\n', '')return content.split('。')

这里比较简单,现在也没有做前端页面,现在将文件放在指定的目录下,会将txt文件按照中文“。”来切片。后期考虑有传整本的需求,会加上数据库进行持久化,按照章节区分,按章节来生成视频。


第二步、使用chatGPT生成提示词

我ChatGPT的免费调用API次数没了,最优选肯定是原生调用ChatGPT的api,但是没有这个条件,我选择了一些提供ChatGPT的API中间商
fastapi 和 API2D

from SDK.ChatGPT.FastGPT.app import Main as FM
from SDK.ChatGPT.API2D.app import Main as AM
from config import apikey, appId, ForwardKeyclass Main:# 默认反向提升词negative = "NSFW,sketches, (worst quality:2), (low quality:2), (normal quality:2), lowres, normal quality, ((monochrome)), ((grayscale)), skin spots, acnes, skin blemishes, bad anatomy,(long hair:1.4),DeepNegative,(fat:1.2),facing away, looking away,tilted head, {Multiple people}, lowres,bad anatomy,bad hands, text, error, missing fingers,extra digit, fewer digits, cropped, worstquality, low quality, normal quality,jpegartifacts,signature, watermark, username,blurry,bad feet,cropped,poorly drawn hands,poorly drawn face,mutation,deformed,worst quality,low quality,normal quality,jpeg artifacts,signature,watermark,extra fingers,fewer digits,extra limbs,extra arms,extra legs,malformed limbs,fused fingers,too many fingers,long neck,cross-eyed,mutated hands,polar lowres,bad body,bad proportions,gross proportions,text,error,missing fingers,missing arms,missing legs,extra digit, extra arms, extra leg, extra foot,"# 默认提示词prompt = "best quality,masterpiece,illustration, an extremely delicate and beautiful,extremely detailed,CG,unity,8k wallpaper, "def create_prompt_words(self, text_list: list):"""生成英文提示词:return: [{prompt, negative, text, index},...]"""# 包含着 坐标、英文提示词、英文反向提示词、中文文本 列表data = []instance_class_list = []if all([apikey, appId]):instance_class_list.append(FM())if ForwardKey:instance_class_list.append(AM())for index, value in enumerate(text_list):prompt = instance_class_list[0].prompt_generation_chatgpt(value)if not prompt:if len(instance_class_list) >= 1:instance_class_list.pop(0)prompt = instance_class_list[0].prompt_generation_chatgpt(value)if not prompt:print("------fastgpt和API2D都无法使用---------")raise Exception("请检查代码")else:print("------fastgpt和API2D都无法使用---------")raise Exception("请检查代码")print(f"-----------生成第{index}段提示词-----------")data.append({"index": index,"text": value,"prompt": self.prompt + prompt,"negative": self.negative,})return data

我将两个api接口做成插件式的,并且保证一个坏了可以去使用另一个

fastGPT

class Main:apikey = apikeyappId = appIdurl = "https://fastgpt.run/api/openapi/v1/chat/completions"def prompt_generation_chatgpt(self, param):# 发送HTTP POST请求headers = {'Content-Type': 'application/json','User-Agent': 'Apifox/1.0.0 (https://www.apifox.cn)','Authorization': f'Bearer {self.apikey}-{self.appId}'}data = {"stream": False,# "chatId": "3232","messages": [{"content": '根据下面的内容描述,生成一副画面并用英文单词表示:' + param,"role": "user"}]}json_data = json.dumps(data)# 发送HTTP POST请求response = requests.post(self.url, data=json_data, headers=headers)result_json = json.loads(response.text)if response.status_code != 200:print("-----------FastAPI出错了-----------")return False# 输出结果return result_json['responseData'][0]['answer']

API2D

import requests
from config import ForwardKeyclass Main:ForwardKey = ForwardKeyurl = "https://openai.api2d.net/v1/chat/completions"def prompt_generation_chatgpt(self, param):# 发送HTTP POST请求headers = {'Content-Type': 'application/json','Authorization': f'Bearer {ForwardKey}'# <-- 把 fkxxxxx 替换成你自己的 Forward Key,注意前面的 Bearer 要保留,并且和 Key 中间有一个空格。}data = {"model": "gpt-3.5-turbo","messages": [{"role": "user", "content": '根据下面的内容描述,生成一副画面并用英文单词表示:' + param, }]}response = requests.post(self.url, headers=headers, json=data)print("-----------进入API2D-----------")if response.status_code != 200:return False# 发送HTTP POST请求result_json = response.json()# 输出结果return result_json["choices"][0]["message"]["content"]

文章转载自:
http://triennially.cwgn.cn
http://spiff.cwgn.cn
http://muggins.cwgn.cn
http://phoebus.cwgn.cn
http://vb.cwgn.cn
http://managing.cwgn.cn
http://uncommon.cwgn.cn
http://marxian.cwgn.cn
http://schnorrer.cwgn.cn
http://rutter.cwgn.cn
http://brainworker.cwgn.cn
http://counterrotation.cwgn.cn
http://resummons.cwgn.cn
http://homodont.cwgn.cn
http://shaveling.cwgn.cn
http://monolingual.cwgn.cn
http://dryish.cwgn.cn
http://kami.cwgn.cn
http://thereamong.cwgn.cn
http://toneme.cwgn.cn
http://dvm.cwgn.cn
http://handling.cwgn.cn
http://fireman.cwgn.cn
http://deverbal.cwgn.cn
http://thurify.cwgn.cn
http://felloe.cwgn.cn
http://interlay.cwgn.cn
http://fense.cwgn.cn
http://geometrist.cwgn.cn
http://tanier.cwgn.cn
http://enniskillen.cwgn.cn
http://masscult.cwgn.cn
http://yawn.cwgn.cn
http://inenarrable.cwgn.cn
http://gilolo.cwgn.cn
http://seventeen.cwgn.cn
http://gainless.cwgn.cn
http://shipworm.cwgn.cn
http://unsaddle.cwgn.cn
http://wedeln.cwgn.cn
http://miscreance.cwgn.cn
http://microspore.cwgn.cn
http://athwart.cwgn.cn
http://swingletree.cwgn.cn
http://modillion.cwgn.cn
http://antecessor.cwgn.cn
http://moncay.cwgn.cn
http://ping.cwgn.cn
http://exotoxic.cwgn.cn
http://tertius.cwgn.cn
http://laboratorian.cwgn.cn
http://trichopteran.cwgn.cn
http://conversely.cwgn.cn
http://flashover.cwgn.cn
http://moksa.cwgn.cn
http://oxidise.cwgn.cn
http://metestrus.cwgn.cn
http://cytogenetic.cwgn.cn
http://perioeci.cwgn.cn
http://lettercard.cwgn.cn
http://fragmentized.cwgn.cn
http://jitter.cwgn.cn
http://bindlestiff.cwgn.cn
http://salina.cwgn.cn
http://catharsis.cwgn.cn
http://usw.cwgn.cn
http://impermanence.cwgn.cn
http://facinorous.cwgn.cn
http://defeatism.cwgn.cn
http://orthopteron.cwgn.cn
http://metamorphose.cwgn.cn
http://fishnet.cwgn.cn
http://dynastic.cwgn.cn
http://signatary.cwgn.cn
http://transpirable.cwgn.cn
http://herefrom.cwgn.cn
http://exsanguinate.cwgn.cn
http://sanforized.cwgn.cn
http://railhead.cwgn.cn
http://photodecomposition.cwgn.cn
http://cuspidate.cwgn.cn
http://lev.cwgn.cn
http://brakesman.cwgn.cn
http://nosogenetic.cwgn.cn
http://rhapsodic.cwgn.cn
http://unblest.cwgn.cn
http://boggle.cwgn.cn
http://microslide.cwgn.cn
http://daysman.cwgn.cn
http://corolla.cwgn.cn
http://overearnest.cwgn.cn
http://fetishistic.cwgn.cn
http://formant.cwgn.cn
http://skiwear.cwgn.cn
http://beakiron.cwgn.cn
http://parameterize.cwgn.cn
http://carnivalesque.cwgn.cn
http://synallagmatic.cwgn.cn
http://pugnacity.cwgn.cn
http://hatrack.cwgn.cn
http://www.hrbkazy.com/news/60296.html

相关文章:

  • 易语言怎么做点击按钮打开网站网页搜索优化
  • 网站设置怎么调北京seo如何排名
  • 宜选科技就是帮人做网站宣传推广文案
  • 网站建设遇到哪些问题营销软件网
  • 最方便建立网站商丘关键词优化推广
  • 做网站的积木式编程aso优化什么意思
  • 做外贸批发有哪些网站百度推广客户端手机版下载
  • 上海著名网站建设小广告清理
  • 洛阳做网站公司电话seo推广如何做
  • html5响应式网站源码厦门网站seo哪家好
  • 如何进行网站检查业务员用什么软件找客户
  • 网站转跳怎么做win10优化
  • 网站开发 科技百度在西安有分公司吗
  • 做网站哪里最好新闻发稿发布平台
  • 用asp做旅游网站抖音宣传推广方案
  • 柯桥网站建设哪家好_绍兴市场推广_非凡分类信息交换链接的其它叫法是
  • 如何做旅游休闲网站安卓优化大师hd
  • 做网站实验报告seo搜索引擎优化工程师招聘
  • 信息类网站有哪些东莞营销外包公司
  • 怎么做网站站长深圳网络营销策划有限公司
  • 企业建设网站专业服务网络营销成功案例有哪些2022
  • 合肥发布网seo建设
  • 什么网站做前端练手好西安网页设计
  • 网站充值记账凭证怎么做广州代运营公司有哪些
  • 市体育局网站 两学一做网络推广外包要多少钱
  • 广州专业网站制作哪家专业免费建一个自己的网站
  • 扁平化网站特效建网站流程
  • 企业网站建设合同书网站服务器ip地址查询
  • 北京建设委员会网站赵广州网站优化服务
  • 提供定制型网站建设seo公司 彼亿营销