Exemple #1
0
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

# 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))
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):