from diffgram import Project # TODO replace `Project()` with full credential object - to get started quickly can copy and paste from Share/Developer Auth project = Project() # Gets target joint directory # TODO replace string `joint_dir` with desired name # This is the dir that will house the combination of next two dirs join_dir = project.directory.get("joint_dir") # TODO replace string `first` with desired name first_dir = project.directory.get("first") # Gets directory object file_list = first_dir.list_files() # Gets list of files. can add search_term print("Length", len(file_list)) result = join_dir.add(file_list) print(result) # TODO replace string `second` with desired name second_dir = project.directory.get("second") file_list = second_dir.list_files() print("Length", len(file_list)) result = join_dir.add(file_list) print(result) # Can add further datasets here. Or can do this on demand # Verify results file_list = join_dir.list_files() print("Length Joint", len(file_list))
from diffgram import Project project = Project(project_string_id="replace_with_project_string", client_id="replace_with_client_id", client_secret="replace_with_client_secret") brain = project.get_model(name="my_model") brain.check_status() print(brain.status)
from diffgram import Project import settings """ Most minimal example of creating and launching a new job. """ project = Project( project_string_id = "replace_with_project_string", client_id = "replace_with_client_id", client_secret = "replace_with_client_secret" ) path = "file_path" file = project.file.from_local(path) job = project.job.new( name = "my job from SDK", file_list = [file], launch = True )
from diffgram import Project project = Project(project_string_id="replace_with_project_string", client_id="replace_with_client_id", client_secret="replace_with_client_secret") # Replace with your brain name, or leave blank to get latest # Must set local flag to True brain = project.get_model(name=None, local=True) # Local, replace with yoru path path = "A:/Sync/work/20190311_200900.jpg" inference = brain.predict_from_local(path) instance = inference.instance_list[0] print(instance.location) print(instance.score) print(instance.label)
from diffgram import Project project = Project(project_string_id="replace_with_project_string", client_id="replace_with_client_id", client_secret="replace_with_client_secret") project.set_directory_by_name("directory_name") path = "file_path" file = project.file.from_local(path) print(file.id)
import numpy as np from scipy.misc import imsave """ Example of predicting locally from webcam -> using two different brains -> displays results live using matplotlib -> saves images to directory for review """ project = Project(client_id=settings.CLIENT_ID, client_secret=settings.CLIENT_SECRET, project_string_id=settings.PROJECT_STRING_ID, debug=False) page_brain = project.get_model(name="page", local=True) graphs_brain = project.get_model(name="graphs_three", local=True) SAVE_IMAGES = True # TODO optional to use temp directory #temp = tempfile.mkdtemp() #directory = temp + "/" + str(time.time()) + "/" directory = str(time.time()) if not os.path.exists(directory):