Skip to content

Instantly share code, notes, and snippets.

@bas-kirill
Created September 16, 2022 18:52
Show Gist options
  • Save bas-kirill/7703e5463715b4d66f6311d512a5e141 to your computer and use it in GitHub Desktop.
Save bas-kirill/7703e5463715b4d66f6311d512a5e141 to your computer and use it in GitHub Desktop.
import uuid
from django.db import models
from zero10.abstract_models import ModelWithCreatedAndUpdatedFields
class MLModel(ModelWithCreatedAndUpdatedFields):
id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
name = models.CharField(
max_length=256,
help_text="Model name or type, e.g., 'segmentation_model_v124', 'segmentation_model'",
)
orig_model_url = models.URLField()
encrypted_model_url = models.URLField()
md5 = models.CharField(max_length=32, blank=True)
input_shape = models.CharField(max_length=256, blank=False)
output_shape = models.CharField(max_length=256, blank=False)
def __str__(self):
return (
f"{self.id}, "
f"{self.name}, "
f"{self.orig_model_url}, "
f"{self.encrypted_model_url}, "
f"{self.md5}, "
f"{self.input_shape}, "
f"{self.output_shape}, "
f"{self.updated}, "
f"{self.created}"
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment