Web platform for sharing free image data for ML and research

Homepage: https://datasets.roundabout-host.com

Fix the models

by roundabout, Wednesday, 14 August 2024, 14:28:04 (1723645684), pushed by roundabout, Thursday, 15 August 2024, 07:42:21 (1723707741)

Author identity: vlad <vlad.muntoiu@gmail.com>

fac9f348c7ee55c2e100609526ce2a8bc21a8f46

app.py

@@ -81,6 +81,7 @@ with app.app_context():

                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                    timestamp = db.Column(db.DateTime, nullable=False, default=datetime.utcnow)
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                    origin_url = db.Column(db.String(2048), nullable=True)        # should be left empty if it's original or the source is unknown but public domain
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                            
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                        
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                class PictureNature(db.Model):
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                    # Examples:
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                    # "photo", "paper-scan", "2d-art-photo", "sculpture-photo", "computer-3d", "computer-painting",
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        

@@ -88,7 +89,7 @@ with app.app_context():

                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                    # "screen-photo", "pattern", "collage", "ai", and so on
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                    id = db.Column(db.String(64), primary_key=True)
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                    description = db.Column(db.UnicodeText, nullable=False)
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                resources = db.relationship("PictureResource", backref="nature")
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                resources = db.relationship("PictureResource", back_populates="nature")
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                            
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                    def __init__(self, id, description):
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                        self.id = id
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        

@@ -102,9 +103,9 @@ with app.app_context():

                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                                         primary_key=True)
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                            
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                    parent = db.relationship("PictureObject", foreign_keys=[parent_id],
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                                         backref="child_links")
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                                         back_populates="child_links")
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                    child = db.relationship("PictureObject", foreign_keys=[child_id],
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                                        backref="parent_links")
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                                        back_populates="parent_links")
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                            
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                    def __init__(self, parent, child):
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                        self.parent = parent
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        

@@ -117,15 +118,16 @@ with app.app_context():

                                
                                
                                
                            
                                
                                    
                                        
                                            
                                            
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                    child_links = db.relationship("PictureObjectInheritance",
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                                                  foreign_keys=[PictureObjectInheritance.parent_id],
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                                              backref="parent")
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                                              back_populates="parent")
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                    parent_links = db.relationship("PictureObjectInheritance",
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                                                   foreign_keys=[PictureObjectInheritance.child_id],
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                                               backref="child")
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                                               back_populates="child")
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                            
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                    def __init__(self, id, description):
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                        self.id = id
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                        self.description = description
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                            
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                        
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                class PictureRegion(db.Model):
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                    # This is for picture region annotations
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                    id = db.Column(db.Integer, primary_key=True, autoincrement=True)
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        

@@ -154,17 +156,18 @@ with app.app_context():

                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                    nature = db.relationship("PictureNature", back_populates="resources")
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                            
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                    replaces_id = db.Column(db.Integer, db.ForeignKey("picture_resource.id"), nullable=True)
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                replaced_by_id = db.Column(db.Integer, db.ForeignKey("picture_resource.id"), nullable=True)      # if this is set, this resource is obsolete and hidden from search results, only available if asked for
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                        
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                replaces = db.relationship("PictureResource", foreign_keys=[replaces_id], backref="replaced_by")
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                replaced_by = db.relationship("PictureResource", foreign_keys=[replaced_by_id], backref="replaces")
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                        
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                replaced_by_id = db.Column(db.Integer, db.ForeignKey("picture_resource.id"),
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                                           nullable=True)
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                            
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                licences = db.relationship("ResourceLicence",                 # a work can be under multiple licences; at least one must be free, but others can be proprietary
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                                           back_populates="resource")
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                replaces = db.relationship("PictureResource", remote_side="PictureResource.id",
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                                           foreign_keys=[replaces_id], back_populates="replaced_by")
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                replaced_by = db.relationship("PictureResource", remote_side="PictureResource.id",
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                                              foreign_keys=[replaced_by_id])
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                            
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                licences = db.relationship("PictureLicence", back_populates="resource")
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                            
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                def __init__(self, title, description, origin_url, licence_ids, mime, size, nature, replaces=None):
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                def __init__(self, title, description, origin_url, licence_ids, mime, size, nature,
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                             replaces=None):
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                        self.title = title
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                        self.description = description
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                        self.origin_url = origin_url