Spaces:
Sleeping
Sleeping
Download models.py from Team-Agrovision/Agrovision: direct link, hf CLI and curl.
- Browser
- Download file 991 Bytes
-
https://huggingface.co/spaces/Team-Agrovision/Agrovision/resolve/main/models.py
- Command line
-
hf download hf://spaces/Team-Agrovision/Agrovision/models.py
-
curl -L -o models.py https://huggingface.co/spaces/Team-Agrovision/Agrovision/resolve/main/models.py
991 Bytes
| from flask_sqlalchemy import SQLAlchemy | |
| from werkzeug.security import generate_password_hash, check_password_hash | |
| from datetime import datetime | |
| db = SQLAlchemy() | |
| class User(db.Model): | |
| id = db.Column(db.Integer, primary_key=True) | |
| email = db.Column(db.String(150), unique=True, nullable=False) | |
| password_hash = db.Column(db.String(200), nullable=False) | |
| images = db.relationship('Image', backref='user', lazy=True) | |
| 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) | |
| class Image(db.Model): | |
| id = db.Column(db.Integer, primary_key=True) | |
| filename = db.Column(db.String(255), nullable=False) | |
| user_id = db.Column(db.Integer, db.ForeignKey('user.id'), nullable=False) | |
| prediction = db.Column(db.String(255), nullable=True) | |
| created_at = db.Column(db.DateTime, default=datetime.utcnow) | |