20 lines
684 B
Python
20 lines
684 B
Python
from database.database import db
|
|
|
|
class Image(db.Model):
|
|
__tablename__ = 'image'
|
|
|
|
image_id = db.Column(db.Integer, primary_key=True, autoincrement=True)
|
|
image_path = db.Column(db.String(500), nullable=False)
|
|
project_id = db.Column(db.Integer, db.ForeignKey('label_studio_project.project_id', ondelete='CASCADE'), nullable=False)
|
|
width = db.Column(db.Integer)
|
|
height = db.Column(db.Integer)
|
|
|
|
def to_dict(self):
|
|
return {
|
|
'image_id': self.image_id,
|
|
'image_path': self.image_path,
|
|
'project_id': self.project_id,
|
|
'width': self.width,
|
|
'height': self.height
|
|
}
|