1414
1515from roboflow .adapters import rfapi , vision_events_api
1616from roboflow .adapters .rfapi import AnnotationSaveError , ImageUploadError , RoboflowError
17- from roboflow .config import API_URL , APP_URL , CLIP_FEATURIZE_URL , DEMO_KEYS
18- from roboflow .core .project import Project
19- from roboflow .util import folderparser
20- from roboflow .util .active_learning_utils import check_box_size , clip_encode , count_comparisons
21- from roboflow .util .general import extract_zip as _extract_zip
22- from roboflow .util .image_utils import load_labelmap
23- from roboflow .util .model_processor import process
24- from roboflow .util .two_stage_utils import ocr_infer
25- from roboflow .util .versions import normalize_yolo_model_type
17+ from roboflow .config import API_URL , APP_URL , DEMO_KEYS
2618
2719
2820class Workspace :
@@ -63,6 +55,8 @@ def projects(self):
6355 Returns:
6456 List of Project objects.
6557 """
58+ from roboflow .core .project import Project
59+
6660 projects_array = []
6761 for a_project in self .project_list :
6862 proj = Project (self .__api_key , a_project , self .model_format )
@@ -82,6 +76,8 @@ def project(self, project_id):
8276 Returns:
8377 Project Object
8478 """
79+ from roboflow .core .project import Project
80+
8581 sys .stdout .write ("\r " + "loading Roboflow project..." )
8682 sys .stdout .write ("\n " )
8783 sys .stdout .flush ()
@@ -112,6 +108,8 @@ def create_project(self, project_name, project_type, project_license, annotation
112108 Returns:
113109 Project Object
114110 """ # noqa: E501 // docs
111+ from roboflow .core .project import Project
112+
115113 data = {
116114 "name" : project_name ,
117115 "type" : project_type ,
@@ -142,6 +140,9 @@ def clip_compare(self, dir: str = "", image_ext: str = ".png", target_image: str
142140 dict: a key:value mapping of image_name:comparison_score_to_target
143141 """ # noqa: E501 // docs
144142
143+ from roboflow .config import CLIP_FEATURIZE_URL
144+ from roboflow .util .active_learning_utils import clip_encode
145+
145146 # list to store comparison results in
146147 comparisons = []
147148 # grab all images in a given directory with ext type
@@ -248,6 +249,8 @@ def two_stage_ocr(
248249 """ # noqa: E501 // docs
249250 from PIL import Image
250251
252+ from roboflow .util .two_stage_utils import ocr_infer
253+
251254 results = []
252255
253256 # create PIL image for cropping
@@ -310,6 +313,9 @@ def upload_dataset(
310313 num_retries (int, optional): number of times to retry uploading an image if the upload fails. Defaults to 0.
311314 is_prediction (bool, optional): whether the annotations provided in the dataset are predictions and not ground truth. Defaults to False.
312315 """ # noqa: E501 // docs
316+ from roboflow .util import folderparser
317+ from roboflow .util .image_utils import load_labelmap
318+
313319 if dataset_format != "NOT_USED" :
314320 print ("Warning: parameter 'dataset_format' is deprecated and will be removed in a future release" )
315321 project , created = self ._get_or_create_project (
@@ -463,6 +469,9 @@ def active_learning(
463469 use_localhost: (bool) = determines if local http format used or remote endpoint
464470 local_server: (str) = local http address for inference server, use_localhost must be True for this to be used
465471 """ # noqa: E501 // docs
472+ from roboflow .config import CLIP_FEATURIZE_URL
473+ from roboflow .util .active_learning_utils import check_box_size , clip_encode , count_comparisons
474+
466475 if inference_endpoint is None :
467476 inference_endpoint = []
468477 if conditionals is None :
@@ -611,6 +620,9 @@ def deploy_model(
611620 filename (str, optional): The name of the weights file. Defaults to "weights/best.pt".
612621 """
613622
623+ from roboflow .util .model_processor import process
624+ from roboflow .util .versions import normalize_yolo_model_type
625+
614626 if not project_ids :
615627 raise ValueError ("At least one project ID must be provided" )
616628
@@ -805,6 +817,8 @@ def search_export(
805817 ValueError: If both *dataset* and *annotation_group* are provided.
806818 RoboflowError: On API errors or export timeout.
807819 """
820+ from roboflow .util .general import extract_zip as _extract_zip
821+
808822 if dataset is not None and annotation_group is not None :
809823 raise ValueError ("dataset and annotation_group are mutually exclusive; provide only one" )
810824
0 commit comments