Python皮皮AI文章伪原创工具
Python皮皮AI文章伪原创工具,主要功能是 利用`AI`工具来伪原创文章, 录入原文可以生成新的文章。
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()
本文结束