Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug : Fix - API only migrations #255

Merged
merged 2 commits into from
May 30, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions backend/core/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@
import traceback
from shutil import rmtree

import hot_fair_utilities
import ramp.utils
import tensorflow as tf

from celery import shared_task
from core.models import AOI, Feedback, FeedbackAOI, FeedbackLabel, Label, Training
from core.serializers import (
Expand All @@ -25,8 +23,6 @@
from django.contrib.gis.geos import GEOSGeometry
from django.shortcuts import get_object_or_404
from django.utils import timezone
from hot_fair_utilities import preprocess, train
from hot_fair_utilities.training import run_feedback
from predictor import download_imagery, get_start_end_download_coords

logger = logging.getLogger(__name__)
Expand Down Expand Up @@ -82,6 +78,13 @@ def train_model(
feedback=None,
freeze_layers=False,
):
#importing them here so that it won't be necessary when sending tasks ( api only)
import hot_fair_utilities
import ramp.utils
import tensorflow as tf
from hot_fair_utilities import preprocess, train
from hot_fair_utilities.training import run_feedback

training_instance = get_object_or_404(Training, id=training_id)
training_instance.status = "RUNNING"
training_instance.started_at = timezone.now()
Expand Down