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")

# 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)
Exemple #2
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)
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):
    os.makedirs(directory)

cap = cv2.VideoCapture(0)