def grid(): if request.method == "POST": anagram = make_anagram(random.choice(NINE_LETTER_LIST)) middle_letter = anagram[len(anagram) // 2] answers = puzzle_answers(anagram, DICTIONARY, letter=middle_letter) answers = plural_filter(answers, DICTIONARY) print(data(anagram, answers)) return jsonify(data(anagram, answers)) return render_template("grid.html")
def ladder(): if request.method == "POST": submitted = request.get_json(force=True) length = submitted["length"] anagram = make_anagram(get_word(length, FULL_WORD_LIST)) answers = anagram_answers(len(anagram), anagram, DICTIONARY) print(data(anagram, answers)) return jsonify(data(anagram, answers)) return render_template("ladder.html")
def rack(): if request.method == "POST": submitted = request.get_json(force=True) length = int(submitted["length"]) letters = draw_letters(LETTERS, length) answers = puzzle_answers(letters, DICTIONARY) high = high_scorer(answers, SCORES, RACK_HIGH) print(data(letters, answers, high)) return jsonify(data(letters, answers, high)) return render_template("rack.html")
dest="arch", action="store", default="densenet121", type=str) ap.add_argument('--hidden_units', type=int, dest="hidden_units", action="store", default=120) pa = ap.parse_args() path = pa.save_dir lr = pa.learning_rate structure = pa.arch dropout = pa.dropout hidden_layer1 = pa.hidden_units power = pa.gpu epochs = pa.epochs trainloader, validationloader, testloader, train_data = functions.data() model, optimizer, criterion = functions.setup(structure, dropout, hidden_layer1, lr, power) functions.train_network(model, criterion, optimizer, trainloader, validationloader, epochs, 20, power) functions.save_checkpoint(train_data, epochs, structure, hidden_layer1, dropout, lr, path) print("The Model is trained")
ap.add_argument('--category_names', dest="category_names", action="store", default='cat_to_name.json') ap.add_argument('--gpu', default="gpu", action="store", dest="gpu") pa = ap.parse_args() path_image = pa.input_img number_of_outputs = pa.top_k power = pa.gpu input_img = pa.input_img path = pa.checkpoint model, _, _ = functions.setup() training_loader, testing_loader, validation_loader, train_data = functions.data( ) functions.load_checkpoint(path) with open('cat_to_name.json', 'r') as json_file: cat_to_name = json.load(json_file) probabilities = functions.predict(path_image, model, number_of_outputs, power) labels = [ cat_to_name[str(index + 1)] for index in np.array(probabilities[1][0]) ] probability = np.array(probabilities[0][0]) i = 0 while i < number_of_outputs:
def showinfostation(self, currentStation=False): """ Args: currentStation: Wordt er op huidige station geklikt dan is varaible station utrecht, anders False Returns: Return False als er geen match is, of station als er wel een match is """ if currentStation: # huidige station gklikt station = 'Utrecht' else: # niet huidige station geklikt en gebruiker klikt op "vertrijktijden station" station = self.inputStationWindow.inputField.get() # krijg informatie uit de input field if station == '': # is het leeg laat error box zien tkinter.messagebox.showerror("Invoerveld leeg", "Gelieve iets in te voeren") # error box return False # stop met uitvoeren van deze functie db_conn = database() # database verbinding class if station == 'update_station_list': # wordt de commando ingetypt dan update station lijst db_conn.update_station_names() # lees excel bestand uit en stop het in de db tkinter.messagebox.showinfo("update", "Update compleet") # message complete met uitvoeren return False # stop met uitvoeren van deze functie valid_station = db_conn.read_from_db_by_input(station) # kijk of station bekend is in db station_info = False if valid_station: # is het een geldige station verkrijg informatie station_info = functions.data(valid_station) # verkrijg informatie if station_info != 'conn_error' and not False: # is het niet False ga door self.showInfoWindow.infoLabel[ "text"] = 'Huidig station: ' + valid_station + '\n' # Huidige station naam ingevuld door gebruiker for station in station_info: # loop informatie # station[0] = Tijd # station[1] = Vertraging # station[2] = Soort trein # station[3] = Naar locatie # station[4] = Spoor # station[5] = Route self.showInfoWindow.listbox.insert(END, 'Om {} {} vertrekt een {} naar {} op spoor: {}'.format(station[0], station[1], station[2], station[3], station[ 4])) # insert informatie in scrollbare lijst if station[5]: # is route meegelverd dan loop for route in station[5].split(','): # split string naar list bij komma en loop self.showInfoWindow.listbox.insert(END, ' · {}'.format(route)) self.viewInfoFrame() # laat infoscherm zien elif station_info == 'conn_error': # geen verbinding show error tkinter.messagebox.showerror("Error", 'Geen verbinding') # messagebox geen verbinding else: # station bestaat niet tkinter.messagebox.showerror("Error", 'Station bestaat niet!') # messagebox geen station
def main(): env_setup() HEPD, MEPD = data(orbit_no, True, True) plot(HEPD, MEPD, 'south', 'spacepy', 'plot_combined', 'pdf')