英文伪原创工具( 2021-09-0217:43Python可乐皮皮AI工具 )

优采云 发布时间: 2022-03-30 05:24

  英文伪原创工具(

2021-09-0217:43Python可乐皮皮AI工具

)

  一目了然,用Python开发一个AI文章伪原创工具

  2021-09-02 17:43·蟒蛇可乐

  这次给大家带来一个Pippi AI工具,一个自己练习的工具

  主要功能是使用`AI`工具伪原创文章,输入原文生成新的文章

  原理是二次翻译

  先翻译成英文再翻译成中文

  

  话不多说,以下是全部Python代码

  可以私信小编01获取大量Python学习资源

  import tkinter as tk

import tkinter.messagebox as messagebox

import requests

import simplejson as json

from requests.packages import urllib3

# 屏蔽SSL错误(提醒)

urllib3.disable_warnings()

root = tk.Tk()

root.title("皮皮AI工具")

ws = root.winfo_screenwidth()

hs = root.winfo_screenheight()

w = 1000

h = 565

x = (ws / 2) - (w / 2)

y = (hs / 2) - (h / 2)

root.geometry('%dx%d+%d+%d' % (w, h, x, y))

root.resizable(0, 0)

source = tk.Text(root,background='gray75', width=65,height=50)

source.pack(side=tk.LEFT)

pad = tk.Text(root,background='gray75', width=65,height=50)

pad.pack(side=tk.RIGHT)

def trans(q):

url = "http://wx-dsh.dokeel.com/app/trans"

params = {

'q':q

}

r = requests.get(url, params=params)

return r.json()

def Trans():

messagebox.showinfo( "提示", "皮皮AI创作中.")

word = source.get(1.0,tk.END)

if (word is None) or (word == ''):

messagebox.showerror( "错误提示", "未检测到文本.")

return

res = trans(word)

if(res['errorCode']!=0):

messagebox.showerror( "错误提示", res['errorMsg'])

return

text = ''

for var in res['translateResult']:

for item in var:

text+=item['tgt']

text+='\n'

res = trans(text)

if(res['errorCode']!=0):

messagebox.showerror( "错误提示", res['errorMsg'])

return

pad.delete(1.0, tk.END)

for var in res['translateResult']:

for item in var:

pad.insert(tk.INSERT, item['tgt'])

pad.insert(tk.INSERT, '\n')

transBtn = tk.Button(root, text="一键AI洗稿", command = Trans)

transBtn.pack(side=tk.TOP)

root.mainloop()

0 个评论

要回复文章请先登录注册


官方客服QQ群

微信人工客服

QQ人工客服


线