Quickstart: Generate your first datapoint#

The code sample below generates a data request that you can submit to our platform to get a visual datapoint of a synthetic human.

Step 1: Create your data request#

This page contains an interactive Python kernel that installs our PyPi package on pageload.

!pip install datagen-tech -q

Click Run in the code block below to generate a download request.

from datagen import api
from datagen.api import assets, catalog
from datagen.api.catalog import attributes
from datagen.api.catalog.attributes import Gender, Ethnicity, Age
import random

# choose an actor
human = random.choice(catalog.humans.get(limit=300))

# define the background & camera
background = random.choice(catalog.backgrounds.get())
default_camera = assets.Camera()
datapoint_requests = [api.create_datapoint(human=human, camera=default_camera, background=background)]

# define the datapoint and create a json file
api.dump(assets.DataRequest(datapoints=datapoint_requests), path="data_request.json")

Next, click Run below to generate a link to the JSON file you created.

from IPython.display import HTML
import os, base64

def make_download_link(filepath):
  filename = os.path.basename(filepath)
  with open(filepath, "rb") as f:
    data = base64.b64encode(f.read()).decode()
    return HTML(f'<h3><a href="data:application/binary;base64,{data}" download={filename}>Click here</a> to download {filename}.</h3>')

filepath = "data_request.json"
make_download_link(filepath)

Step 2: Generate your data#

Log in or Sign up for free

See Generating your data for instructions on how to upload your data request. We will start generating your datapoint immediately.

../_images/random_sample.png

An example of a randomly generated datapoint.#