def main(): random.seed() #weights for each input weights = [] n = 0.001 train(weights, n, "mnist_train.csv", "mnist_test.csv", "accuracyTrain001.csv", "accuracyTest001.csv", "conMatrixTest001.csv") main2.main() main3.main()
def run(self, dispatcher, tracker, domain): annual_income = tracker.get_slot('income') income_tax = tracker.get_slot('tax') employemt_type = tracker.get_slot('employ') liquid_net_worth = tracker.get_slot('networth') finanical_goal = tracker.get_slot('goal') expected_returns = tracker.get_slot('returns') would = tracker.get_slot('would') need = tracker.get_slot('need') text = main2.main(annual_income=annual_income, income_tax=income_tax, liquid_net_worth=liquid_net_worth, employment_type=employemt_type, financial_goal=finanical_goal, expected_returns=expected_returns, would=would, need=need, acount_money='1,111,111.00') soup = BeautifulSoup(text, 'html.parser') portfolio = ['your portfolio:'] for tbody in soup.find('tbody'): if isinstance(tbody, bs4.element.Tag): tds = tbody('td') portfolio.append([tds[0].string, tds[1].string, tds[2].string]) #portfolio.append('\n') dispatcher.utter_message(str(portfolio))
def find_name(newname): names, name, desc = main() if isinstance(names, dict): with open("database.pkl", mode="rb") as opened_file: database = pickle.load(opened_file) if newname in database: database = portfolio.update_profile(names[name], newname, database) else: database = portfolio.create_profile(names[name], newname, database) with open("database.pkl", mode="wb") as opened_file: pickle.dump(database, opened_file) session.attributes["current_person"] = newname return question("Okay. Hello " + newname + " would you like to hear your fortune?") else: return question("Please look in the camera and say your name again")
def launch_app(): global current_dict names, name, desc = main() current_dict = names if isinstance(names, dict): for name in names: # updates or creates a profile if "Unknown" not in name: namereturn = name session.attributes["current_person"] = namereturn return question("You are" + namereturn + ", right?") else: return question("Hello, what is your name?") else: return question(names)
def data(): # from werkzeug.datastructures import FileStorage # file = None # with open('document-test/test.pdf', 'rb') as fp: # file = FileStorage(fp) # file.save('document-test/test_new.pdf') upload = request.files.getlist('upload') # print(upload) for x in upload: name = x.filename print(name) fl = x.save(name) results = main2.main(name) resp = Response(results) resp.headers[ "Content-Disposition"] = "attachment; filename=\"Analysis.json\"" return resp
import ctypes, sys from getpath import getpath from main2 import main initpath = getpath() sys.path.insert(0, initpath + "\Lib") print(sys.path) def is_admin(): try: return ctypes.windll.shell32.IsUserAnAdmin() except: return False if is_admin(): # 将要运行的代码加到这里 main() else: if sys.version_info[0] == 3: ctypes.windll.shell32.ShellExecuteW(None, "runas", sys.executable, __file__, None, 1) main()
def audiocallback(txb): import main2 txb.insert(END, main2.main())
import sys import os try: from main2 import main from parameters import log except Exception: from COMTool.main2 import main from COMTool.parameters import log def restart_program(): ''' restart program, not return ''' python = sys.executable log.i("Restarting program, comand: {} {} {}".format(python, python, *sys.argv)) os.execl(python, python, * sys.argv) if __name__ == '__main__': while 1: ret = main() if not ret is None: break restart_program() print("-- program exit, code:", ret) sys.exit(ret)