Skip to content

Commit

Permalink
Merge pull request #255 from hotosm/fix/import-error-api
Browse files Browse the repository at this point in the history
Bug : Fix - API only migrations
  • Loading branch information
kshitijrajsharma authored May 30, 2024
2 parents 0701ab7 + 9e8c553 commit 9692d3b
Showing 1 changed file with 8 additions and 5 deletions.
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

0 comments on commit 9692d3b

Please sign in to comment.