class Message(DB.Model): """Model Message""" id = DB.Column(DB.Integer, primary_key=True) data = DB.Column(DB.String(1000)) user_id = DB.Column(DB.Integer, DB.ForeignKey('user.id'), nullable=False) room_id = DB.Column(DB.Integer, DB.ForeignKey('room.id'), nullable=False) user = DB.relationship('User') room = DB.relationship('Room') posted_at = DB.Column(DB.DateTime, nullable=False, default=datetime.utcnow)
class User(DB.Model): """Model User""" id = DB.Column(DB.Integer, primary_key=True) email = DB.Column(DB.String(120), unique=True, nullable=False) password_hash = DB.Column(DB.String(128)) def __repr__(self): return '<User %r>' % self.email def set_password(self, password): self.password_hash = generate_password_hash(password) def check_password(self, password): return check_password_hash(self.password_hash, password)
def main(args): print(args) device = torch.device('cuda') torch.set_grad_enabled(False) args.alpha, args.beta, args.margin, args.lr = 0, 0, 0, 0 vae = IntroVAE(args).to(device) vae.load_state_dict(torch.load(args.load)) print('load ckpt from:', args.load) args.root = '/dev/null' args.data_aug = False db = DB(args) db.images = args.input imgs = [img for img in db] x = torch.stack(imgs, dim=0).to(device) mu, logvar = vae.encoder(x) feature = mu.cpu().numpy() np.save(args.output, feature)
class Image(DB.Model): __tablename__ = 'Bilder' id = DB.Column(DB.Integer, primary_key=True) uri = DB.Column(DB.String)
class Admins(DB.Model, UserMixin): __tablename__ = 'admins' id = DB.Column(DB.String, primary_key=False) email = DB.Column(DB.String, primary_key=True) authenticated = DB.Column(DB.String, default="false") active = DB.Column(DB.String, default="true")
class Sorts(DB.Model): __tablename__ = 'obstsorten' id = DB.Column(DB.Integer, primary_key=True) fruchtID = DB.Column(DB.Integer) frucht = DB.Column(DB.String) sorte = DB.Column(DB.String) andereNamen = DB.Column(DB.String) herkunft = DB.Column(DB.String) groesse = DB.Column(DB.String) beschreibung = DB.Column(DB.String) reifezeit = DB.Column(DB.String) geschmack = DB.Column(DB.String) verwendung = DB.Column(DB.String) lager = DB.Column(DB.String) verbreitung = DB.Column(DB.String)
class Plantlist(DB.Model): __tablename__ = 'pflanzliste' BaumNr = DB.Column(DB.Integer, primary_key=True) Pflanzreihe = DB.Column(DB.Integer) PflanzreihePosition = DB.Column(DB.Integer) BaumID = DB.Column(DB.Integer) BaumsortenID = DB.Column(DB.Integer) FruchtID = DB.Column(DB.Integer) Frucht = DB.Column(DB.String) SortenID = DB.Column(DB.Integer) Sortenzaehler = DB.Column(DB.Integer) Sorte = DB.Column(DB.String) Ernte = DB.Column(DB.Float) PatenID = DB.Column(DB.String) Longitude = DB.Column(DB.Float) Latitude = DB.Column(DB.Float)
frame_4.pack(fill=X) poetry = "Делать две вещи одновременно — означает не сделать ни одной." \ "\n© Публиус Сирус" label = tk.Label(frame_4, text=poetry, bg="#48466d", fg='#bad7df') label.pack(side=BOTTOM, padx=2, pady=9) self.btn_ok.bind( '<Button-1>', lambda event: self.view.avtorize( self.entry_login.get(), self.entry_pas.get())) self.btn_ok.bind('<Button-1>', lambda event: self.destroy(), add='+') if __name__ == "__main__": """Запуск приложения""" root = tk.Tk() db = DB() poetry = "Добро пожаловать в TASK MANAGER\n" \ "Время — это то, чего мы хотим больше всего и то,\n " \ "что мы хуже всего умеем использовать.\n© Вильям Пенн" label2 = tk.Label(text=poetry, bg="#48466d", font="Times 13", fg="#bad7df") label2.pack(padx=2, pady=7) root.config(bg="#48466d") app = Main(root) app.pack() root.title("Запуск приложения") root.geometry("450x300+300+200") root.resizable(False, False) root.mainloop()
class Room(DB.Model): """Model Room""" id = DB.Column(DB.Integer, primary_key=True) title = DB.Column(DB.String(300))