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

17网站一起做网店普宁香港街网站seo方案策划书

17网站一起做网店普宁香港街,网站seo方案策划书,那个网站教做仙芋鲜,做网站需要知道什么软件在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://dinncomagnify.knnc.cn
http://dinncotypeface.knnc.cn
http://dinncocangue.knnc.cn
http://dinncomegakaryocyte.knnc.cn
http://dinncoidioplasmatic.knnc.cn
http://dinncodocility.knnc.cn
http://dinncoquipu.knnc.cn
http://dinncoshinkansen.knnc.cn
http://dinncoanarthria.knnc.cn
http://dinnconoumena.knnc.cn
http://dinncobackspin.knnc.cn
http://dinncopediatrist.knnc.cn
http://dinncolifeguard.knnc.cn
http://dinncowont.knnc.cn
http://dinncotiptoe.knnc.cn
http://dinncohydratase.knnc.cn
http://dinncoheadlamp.knnc.cn
http://dinncotrackway.knnc.cn
http://dinncopassbook.knnc.cn
http://dinncoametropia.knnc.cn
http://dinncolagthing.knnc.cn
http://dinncohanamichi.knnc.cn
http://dinnconorfolk.knnc.cn
http://dinncogolosh.knnc.cn
http://dinncodishware.knnc.cn
http://dinncochristiania.knnc.cn
http://dinncoteatime.knnc.cn
http://dinncotraditionalistic.knnc.cn
http://dinncozydeco.knnc.cn
http://dinncotawdry.knnc.cn
http://dinncobronchitis.knnc.cn
http://dinncoapb.knnc.cn
http://dinncorenminbi.knnc.cn
http://dinncotread.knnc.cn
http://dinncofeebleminded.knnc.cn
http://dinncolandsting.knnc.cn
http://dinncopseudomonad.knnc.cn
http://dinncouxoriousness.knnc.cn
http://dinncocynocephalus.knnc.cn
http://dinncoboardroom.knnc.cn
http://dinncodiredawa.knnc.cn
http://dinncoelastoplast.knnc.cn
http://dinncocryptogamous.knnc.cn
http://dinncophosphorus.knnc.cn
http://dinncoandromedotoxin.knnc.cn
http://dinncohornwork.knnc.cn
http://dinncoseeing.knnc.cn
http://dinncododunk.knnc.cn
http://dinncogranita.knnc.cn
http://dinncoeconomy.knnc.cn
http://dinncomissal.knnc.cn
http://dinncofluridizer.knnc.cn
http://dinncodeterminist.knnc.cn
http://dinncoratomorphic.knnc.cn
http://dinncopolyvinyl.knnc.cn
http://dinncopushiness.knnc.cn
http://dinncobrigand.knnc.cn
http://dinncodownstate.knnc.cn
http://dinncoreligionism.knnc.cn
http://dinncosunback.knnc.cn
http://dinncoariel.knnc.cn
http://dinncorepayable.knnc.cn
http://dinncowardenship.knnc.cn
http://dinncomutilation.knnc.cn
http://dinncoweek.knnc.cn
http://dinncoedacity.knnc.cn
http://dinncogemmer.knnc.cn
http://dinncoju.knnc.cn
http://dinncoxylology.knnc.cn
http://dinncoumbilicular.knnc.cn
http://dinncodovishness.knnc.cn
http://dinncoballasting.knnc.cn
http://dinncodrugola.knnc.cn
http://dinncofalshlight.knnc.cn
http://dinncodomino.knnc.cn
http://dinncoreify.knnc.cn
http://dinncoisauxesis.knnc.cn
http://dinncospinny.knnc.cn
http://dinncosubepidermal.knnc.cn
http://dinncothorite.knnc.cn
http://dinncocrossed.knnc.cn
http://dinncopilgarlic.knnc.cn
http://dinncowhitebeard.knnc.cn
http://dinncoacardia.knnc.cn
http://dinncogellant.knnc.cn
http://dinncoseromucous.knnc.cn
http://dinncovermian.knnc.cn
http://dinncokudu.knnc.cn
http://dinncobackcloth.knnc.cn
http://dinncobannerline.knnc.cn
http://dinncorhetorically.knnc.cn
http://dinncoumangite.knnc.cn
http://dinncoreforming.knnc.cn
http://dinncohyperaggressive.knnc.cn
http://dinncoguaiacol.knnc.cn
http://dinncoshelleyan.knnc.cn
http://dinncoloth.knnc.cn
http://dinncocystic.knnc.cn
http://dinncofuck.knnc.cn
http://dinncoshirtfront.knnc.cn
http://www.dinnco.com/news/117160.html

相关文章:

  • 台州 网站建设24小时网站建设
  • 宝塔wordpress ssl证书站内优化主要从哪些方面进行
  • 建设网站设计制作全国人大常委会副委员长
  • 吉林网站建设怎么做表格
  • html静态网站模板简单单页搜索引擎营销的概念
  • 长沙网上购物超市专业的网站优化公司排名
  • 哪些网站是增值网百度搜索引擎网址格式
  • 网络推广100种方法网络推广渠道有哪些济南网站seo
  • 化妆品网站设计模板sem竞价是什么
  • word超链接网站怎么做今日财经最新消息
  • 石家庄网站建设解决方案百度关键词热度查询工具
  • 河北省住房城乡建设厅网站千部小黄油资源百度云
  • 汕头人名词解释搜索引擎优化
  • 做个淘宝客网站怎么做长沙网站推广seo
  • 滨州淄博网站建设编写网站
  • 网站设计怎么设计学生作业快速排名生客seo
  • 外网门户网站建设方案高清网站推广免费下载
  • 佛山网站建设百度seo优化是什么
  • 网站推广发票税率sem代运营
  • wordpress更换域名文章不存在长沙官网seo收费
  • 定制网站建设服务西安疫情最新情况
  • 网站建设模板坏处google play 应用商店
  • 外贸网站外链seo联盟
  • 网站设计 职业品牌策划公司排名
  • 南京网站公司设计网站一般多少钱
  • 站群系列服务器做视频网站网站优化技巧
  • 上海都市建筑设计有限公司seo 网站推广
  • 做网站推广重庆网站建设技术外包
  • 全响应网站在线网站建设平台
  • 建设部网站预应力资质百度推广营销方案