Skip to content

Commit

Permalink
pop unnecessary values for instance creation in training
Browse files Browse the repository at this point in the history
  • Loading branch information
kshitijrajsharma committed Mar 24, 2024
1 parent fa84c60 commit 7911a3d
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions backend/core/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,12 +135,18 @@ def create(self, validated_data):
user = self.context["request"].user
validated_data["created_by"] = user
# create the model instance
instance = Training.objects.create(**validated_data)

multimasks = validated_data.get("multimasks", False)
input_contact_spacing = validated_data.get("input_contact_spacing", 0.75)
input_boundary_width = validated_data.get("input_boundary_width", 0.5)

pop_keys = ["multimasks", "input_contact_spacing", "input_boundary_width"]

for key in pop_keys:
if key in validated_data.keys():
validated_data.pop(key)

instance = Training.objects.create(**validated_data)

# run your function here
task = train_model.delay(
dataset_id=instance.model.dataset.id,
Expand Down

0 comments on commit 7911a3d

Please sign in to comment.