Форум сайта python.su
curl -v -X POST 'http://localhost:...
f"docker exec -it {container_id} bash && pwd"
from keras.models import load_model from keras.preprocessing import image from keras.optimizers import SGD import pyautogui import os import numpy as np import time from PIL import ImageGrab, Image import glob # Загрузить сохраненную модель print("Идет загрузка модели...") model1 = load_model("C:/V.1/cat_dog_model.h5") print("Модель загружена") sgd=SGD(lr=0.01, decay=1e-6, momentum=0.9, nesterov=True) model1.compile(optimizer='sgd', loss='categorical_crossentropy') path1 = 'C:/V.1/dataset/test_parent/data/' # Прогнозирование новых изображений filename = None while True: time.sleep(10) box = (1082, 110, 1109, 670) im = ImageGrab.grab(box) filename = str(int(time.time())) + '.png' im.save(path1 + filename, 'PNG') print("Foto save") print("Foto...") list_of_files = glob.glob('C:/V.1/dataset/test_parent/data/*') latest_file = max(list_of_files, key=os.path.getctime) print(latest_file) img = image.load_img(latest_file, target_size = (27, 560)) ## img = img_to_array(img) img = np.expand_dims(img, axis=0) rslt1 = model1.predict(img) if rslt1[0][0] == 0: print('cat') else: print('dog')
month;milk 0 01.01.1962;589 1 01.02.1962;561 2 01.03.1962;640 3 01.04.1962;656 4 01.05.1962;727
month;milk month 0 01.01.1962;589 01.01.1962;589 1 01.02.1962;561 01.02.1962;561 2 01.03.1962;640 01.03.1962;640 3 01.04.1962;656 01.04.1962;656 4 01.05.1962;727 01.05.1962;727
#!/usr/bin/python import MySQLdb import getpass print("-------------------------") print("<<<<<<<<<Welcome>>>>>>>>>") print("-------------------------") username = input("Username:") if username == "username" : password = getpass.getpass(prompt="Enter secret password:") else : print ("please try another user name. This user name is incorrect") print password # Open database connection db = MySQLdb.connect("hostname","user,"pass","db" ) # prepare a cursor object using cursor() method cursor = db.cursor() # execute SQL query using execute() method. cursor.execute("SELECT userID, password from db") # Fetch a single row using fetchone() method. data = cursor.fetchone() # disconnect from server db.close()
id int(11) Автоматическое приращение userID bigint(12) unsigned password varchar(32) PointsQuota tinyint(3) Period tinyint(2) deviceID char(17) user_phone bigint(20) email varchar(128) enable tinyint(2) ssh_port int(5)
import numpy as np import numba as nb @nb.jit(nopython=True) def get_date_time(current): s = current['YEAR'] + '-' + current['MONTH'] + '-' + current['DAY'] + 'T' + current['TIME'] #d = np.datetime64(s) #ERROR: Cannot cast unicode_type to datetime64[] #d = nb.types.NPDatetime(s) #ERROR: Unknown attribute 'NPDatetime' of type Module(<module 'numba.core.types' #d = nb.types.NPDatetime(Y=current['YEAR'], M=current['MONTH'], D=current['DAY']) #ERROR: Unknown attribute 'NPDatetime' of type Module(<module 'numba.core.types' d = nb.NPDatetime(s) #ERROR: module 'numba' has no attribute 'NPDatetime' return d
import requests endpoint = "https://api2.vetrf.ru:8002" data = {'login':'1111111','passw':'2222222} headers = {'SOAPAction':'submitApplication', 'Content-Type': 'text/xml; charset=utf-8','Accept-Charset':'utf-8','User-Agent': '1C+Enterprise/8.3','Connection': 'Keep-Alive'} session = requests.session() session.headers = headers response = session.post(url=endpoint, data=data) print(response.content)
from tkinter import * from tkinter.ttk import Notebook win = Tk() win.title('Test double chekbutton') win.geometry(f'500x100+{int(win.winfo_screenwidth()/2+50)}+{int(win.winfo_screenheight()/2-130)}') win.resizable(width=False, height=False) tab_control = Notebook(win) tab_01 = Frame(tab_control) tab_control.add(tab_01, text=f'{"1": ^70}') tab_02 = Frame(tab_control) tab_control.add(tab_02, text=f'{"2": ^60s}') frame_other = Frame(win, bg='#FFFF00') checkbut_01 = Checkbutton(tab_01, text='чекается 1', font='Verdana 7 bold') checkbut_02 = Checkbutton(tab_01, text='нормально', font='Verdana 7 bold') checkbut_frameother_03 = Checkbutton(frame_other, text='чекается 2', font='Consolas 10 bold') tab_control.pack() frame_other.pack() checkbut_01.pack() checkbut_02.pack() checkbut_frameother_03.pack() win.mainloop()
class MyManager(models.Manager): def tut(self, x=0, y=0): all_summ = None if x == 1: all_summ = F('price_1') * y elif x == 2: all_summ = (F('price_1') + F('price_2')) * y elif x == 3: all_summ = (F('price_1') + F('price_2') + F('price_3')) * y return super().get_queryset().filter(max_size__gte=x).annotate(my_s=all_summ)