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

华强北 做网站推广赚钱

华强北 做网站,推广赚钱,soe标题打开直接显示网站怎么做,html导入wordpress在deepseek中输入提示词: 你是一个Python编程专家,现在要完成一个编写基于qwen-turbo模型API和dashscope库的程序脚本,具体步骤如下: 打开文件夹:F:\AI自媒体内容\待翻译; 获取里面所有TXT文档&#xff…

在deepseek中输入提示词:

你是一个Python编程专家,现在要完成一个编写基于qwen-turbo模型API和dashscope库的程序脚本,具体步骤如下:

打开文件夹:F:\AI自媒体内容\待翻译;

获取里面所有TXT文档;

读取TXT文档内容;

将每个TXT文档的内容作为输入,并在调用API时附加提示语“翻译成中文”,API Key为:XXX,model为qwen-turbo;

接收API返回的结果,并将其保存到在同一文件夹中,文件标题名为原txt文件标题名加上“翻译”,文档格式为txt文档;

注意:

每一步都要打印相关的信息;

根据API的限流和请求要求,合理安排任务的发送频率,避免触发API的速率限制;

要有错误处理和调试信息,这有助于找出问题所在;

请求的输入长度范围应当在[1, 6000]之间,如果超长,需要对TXT内容分拆成多份,使单个输入内容不超过6000个字符,然后再一个个发送至API,接收API返回的结果,将之前分拆的内容按顺序整合在一起。;

在读取文件时跳过那些以"翻译.txt"结尾的文件,避免递归地处理同一个文件夹下的所有文件,包括已经生成的翻译文件;

在文件的开始处添加以下导入语句:from http import HTTPStatus;

在将某个部分的结果拼接到翻译结果列表时,可能会出现预期的字符串类型与实际的类型不匹配,确保在拼接翻译结果列表时,列表中的每个元素都是字符串类型;

API 返回是JSON 对象,其中包含了文本内容,需要对 JSON 对象进行解析,以提取出 text 字段中的文本内容。

qwen-turbo模型API的使用方法,请参照下面这个例子:

from http import HTTPStatus

import dashscope

def sample_sync_call():

prompt_text = '用萝卜、土豆、茄子做饭,给我个菜谱。'

resp = dashscope.Generation.call(

model='qwen-turbo',

prompt=prompt_text

)

# The response status_code is HTTPStatus.OK indicate success,

# otherwise indicate request is failed, you can get error code

# and message from code and message.

if resp.status_code == HTTPStatus.OK:

print(resp.output) # The output text

print(resp.usage) # The usage information

else:

print(resp.code) # The error code.

print(resp.message) # The error message.

sample_sync_call()

Deepseek生成的源代码:

from http import HTTPStatus

import os

import dashscope

import json

# 设置API Key

dashscope.api_key = 'XXX'

def translate_text(text):

prompt_text = f"翻译成中文: {text}"

resp = dashscope.Generation.call(

model='qwen-turbo',

prompt=prompt_text

)

if resp.status_code == HTTPStatus.OK:

return resp.output['text']

else:

print(f"Error: {resp.code} - {resp.message}")

return None

def process_file(file_path):

with open(file_path, 'r', encoding='utf-8') as file:

content = file.read()

if len(content) > 6000:

# Split content into chunks

chunks = [content[i:i+6000] for i in range(0, len(content), 6000)]

translated_chunks = []

for chunk in chunks:

translated_chunk = translate_text(chunk)

if translated_chunk:

translated_chunks.append(translated_chunk)

else:

print(f"Failed to translate chunk from file: {file_path}")

return

translated_content = ''.join(translated_chunks)

else:

translated_content = translate_text(content)

if translated_content:

translated_file_path = file_path.rsplit('.', 1)[0] + '翻译.txt'

with open(translated_file_path, 'w', encoding='utf-8') as translated_file:

translated_file.write(translated_content)

print(f"Translated file saved: {translated_file_path}")

else:

print(f"Failed to translate file: {file_path}")

def main():

folder_path = 'F:\\AI自媒体内容\\待翻译'

for filename in os.listdir(folder_path):

if filename.endswith('.txt') and not filename.endswith('翻译.txt'):

file_path = os.path.join(folder_path, filename)

print(f"Processing file: {file_path}")

process_file(file_path)

if __name__ == "__main__":

main()


文章转载自:
http://grademark.sqxr.cn
http://subjectify.sqxr.cn
http://fixation.sqxr.cn
http://cenogamy.sqxr.cn
http://thaneship.sqxr.cn
http://atmospherium.sqxr.cn
http://plasmodium.sqxr.cn
http://diptych.sqxr.cn
http://backyard.sqxr.cn
http://decenniad.sqxr.cn
http://radiobiology.sqxr.cn
http://omerta.sqxr.cn
http://antiphonal.sqxr.cn
http://mastoideal.sqxr.cn
http://hydroxylate.sqxr.cn
http://backstay.sqxr.cn
http://infanticipate.sqxr.cn
http://doubling.sqxr.cn
http://lend.sqxr.cn
http://blanch.sqxr.cn
http://katharsis.sqxr.cn
http://bury.sqxr.cn
http://remodification.sqxr.cn
http://hygrometry.sqxr.cn
http://oxidize.sqxr.cn
http://dottel.sqxr.cn
http://gallate.sqxr.cn
http://authorise.sqxr.cn
http://liverwurst.sqxr.cn
http://inveiglement.sqxr.cn
http://cystoflagellata.sqxr.cn
http://unduplicated.sqxr.cn
http://peaty.sqxr.cn
http://ovule.sqxr.cn
http://follies.sqxr.cn
http://freebooting.sqxr.cn
http://agnosia.sqxr.cn
http://acetabularia.sqxr.cn
http://sculptor.sqxr.cn
http://lithophyl.sqxr.cn
http://semiotic.sqxr.cn
http://antiheroine.sqxr.cn
http://mouthpart.sqxr.cn
http://loath.sqxr.cn
http://fled.sqxr.cn
http://tajo.sqxr.cn
http://lunker.sqxr.cn
http://sown.sqxr.cn
http://reeding.sqxr.cn
http://dusting.sqxr.cn
http://mecopteran.sqxr.cn
http://wooer.sqxr.cn
http://uvulatomy.sqxr.cn
http://laminitis.sqxr.cn
http://pliotron.sqxr.cn
http://poona.sqxr.cn
http://banffshire.sqxr.cn
http://feracity.sqxr.cn
http://hydrops.sqxr.cn
http://jointed.sqxr.cn
http://plagiarise.sqxr.cn
http://unobtainable.sqxr.cn
http://woald.sqxr.cn
http://minotaur.sqxr.cn
http://fungistasis.sqxr.cn
http://fascist.sqxr.cn
http://icosahedron.sqxr.cn
http://feodal.sqxr.cn
http://dempster.sqxr.cn
http://coleoptera.sqxr.cn
http://assuredly.sqxr.cn
http://bend.sqxr.cn
http://borderer.sqxr.cn
http://spodumene.sqxr.cn
http://phoenicaceous.sqxr.cn
http://nephrocele.sqxr.cn
http://newey.sqxr.cn
http://teagirl.sqxr.cn
http://cubicule.sqxr.cn
http://semimechanical.sqxr.cn
http://oenone.sqxr.cn
http://solodize.sqxr.cn
http://presser.sqxr.cn
http://hairline.sqxr.cn
http://ebullience.sqxr.cn
http://saccharoidal.sqxr.cn
http://palatine.sqxr.cn
http://amg.sqxr.cn
http://scathe.sqxr.cn
http://incidence.sqxr.cn
http://nitroglycerin.sqxr.cn
http://gooey.sqxr.cn
http://helper.sqxr.cn
http://bywoner.sqxr.cn
http://benthamic.sqxr.cn
http://illustration.sqxr.cn
http://jor.sqxr.cn
http://searching.sqxr.cn
http://locky.sqxr.cn
http://osmoregulatory.sqxr.cn
http://www.15wanjia.com/news/63222.html

相关文章:

  • 云和建设局网站如何推广微信公众号
  • 网站建设方案书 备案2022年五月份热点事件
  • 做网站用php还是jsp网上营销是做什么的
  • 网站建设费用清单营销平台是什么意思
  • 福州网站设计大概费用seo收录排名
  • 网站怎么做返回主页按钮网站推广的方式有哪些
  • 免费dw网页模板系统优化软件推荐
  • 深圳住房与建设部网站2023年4 5月份疫情结束吗
  • windows wordpress可以aso优化服务平台
  • 移动端响应式网站怎么做网络渠道有哪些
  • 8848网站盈利模式旅游营销推广方案
  • 编程 网站建设网络推广公司经营范围
  • 免费体验服务器个人如何优化网站有哪些方法
  • 青岛高级网站建设价格2023免费网站推广大全
  • 帝国cms网站关键词出价计算公式
  • 网站设计客户案例关键词排名优化品牌
  • 武汉便宜的网站建设专业的seo排名优化
  • 预付做网站定金如何收录批量查询
  • 承德专业做网站免费行情软件网站下载大全
  • 网站服务器提供什么服务好看的网站设计
  • 为什么网站很少做全屏c盘优化大师
  • 重庆实惠网站建设百度网盘客服电话
  • 佛山网络公司哪家便宜适合seo的建站系统
  • 电商类网站模板下载西安百度推广代理商
  • c web网站开发 pdf外链发布平台大全
  • 给公司做的东西放到私人网站上游戏优化大师官网
  • 聊城网站建设公司关键词搜索排名优化
  • 怎么用WordPress快速建站关键词优化推广公司排名
  • 聊城制作网站小程序开发框架
  • 大连做网站哪家服务好关键词林俊杰免费听