Python SDK Quickstart

Python SDK Quickstart

Integrate SeeMe.ai into your Python applications. This guide covers installation, authentication, and common operations.

What You’ll Accomplish

  • Install and configure the SDK
  • Authenticate with your account
  • Create datasets and upload data
  • Train a model
  • Make predictions programmatically

Prerequisites

  • Python 3.8 or higher
  • pip package manager
  • A SeeMe.ai account (sign up)

Step 1: Install the SDK

pip install seeme

Verify the installation:

python -c "import seeme; print(seeme.__version__)"

Step 2: Initialize the Client

from seeme import Client

## Create a client instance with your credentials
client = Client(username="your-username", apikey="your-api-key")
ℹ️
You can store your credentials in a .env file with username, apikey, and optionally backend variables. Then simply call Client() without arguments.

Alternative: Environment File

For convenience, create a .env file in your project directory:

username=your-username
apikey=your-api-key

Then initialize without arguments:

client = Client()

Step 3: Create a Dataset

from seeme.types import Dataset, DatasetContentType

# Create a new image dataset
my_dataset = Dataset(
    name="My Training Dataset",
    description="Images for classification training",
    content_type=DatasetContentType.IMAGES,
    default_splits=True
)

my_dataset = client.create_dataset(my_dataset)

print(f"Dataset created: {my_dataset.id}")

Step 4: Upload Data

Upload a ZIP file

# ZIP structure: folder name = label
# my-data.zip/
#   cats/cat1.jpg, cat2.jpg...
#   dogs/dog1.jpg, dog2.jpg...

# Get the first version
version = client.get_dataset_versions(my_dataset.id)[0]

client.upload_dataset_version(
    dataset_id=my_dataset.id,
    dataset_version_id=version.id,
    folder=".",
    filename="my-data.zip"
)

Upload individual files

from seeme.types import Label, DatasetItem, Annotation

# Get the default version and splits
versions = client.get_dataset_versions(my_dataset.id)
version = versions[0]
splits = client.get_dataset_splits(my_dataset.id, version.id)
train_split = splits[0]

# Create labels
cat_label = client.create_dataset_label(
    dataset_id=my_dataset.id,
    dataset_version_id=version.id,
    label=Label(
        name="cat",
        color="#FF5733",
        version_id=version.id
    )
)

dog_label = client.create_dataset_label(
    dataset_id=my_dataset.id,
    dataset_version_id=version.id,
    label=Label(
        name="dog",
        color="#3498DB",
        version_id=version.id
    )
)

# Upload an image
item = client.create_dataset_item(
    dataset_id=my_dataset.id,
    dataset_version_id=version.id,
    item=DatasetItem(
        name="cat1.jpg"
    )
)

client.upload_dataset_item_image(
    dataset_id=my_dataset.id,
    dataset_version_id=version.id,
    item_id=item.id,
    folder=".",
    filename="cat1.jpg"
)

# Add a label annotation
client.annotate(
    dataset_id=my_dataset.id,
    dataset_version_id=version.id,
    annotation=Annotation(
        item_id=item.id,
        split_id=train_split.id,
        label_id=cat_label.id
    )
)

Step 5: Train a Model

from seeme.types import Job, JobType, JobItem, ValueType, Framework, ApplicationType

# Get the application_id for your framework
application_id = client.get_application_id(
    base_framework=Framework.PYTORCH,
    framework=Framework.FASTAI,
    base_framework_version="2.1.0",
    framework_version="2.7.13",
    application=ApplicationType.IMAGE_CLASSIFICATION
)

# Create a training job
my_job = Job(
    name="Train cat vs dog classifier",
    job_type=JobType.TRAINING,
    application_id=application_id,
    dataset_id=my_dataset.id,
    dataset_version_id=version.id,
    items=[
        JobItem(name="nb_epochs", value="10", value_type=ValueType.INT, label="Number of epochs"),
        JobItem(name="image_size", value="224", value_type=ValueType.INT, label="Image Size"),
        JobItem(name="batch_size", value="32", value_type=ValueType.INT, label="Batch Size"),
        JobItem(name="arch", value="resnet50", value_type=ValueType.TEXT, label="Architecture"),
    ]
)

my_job = client.create_job(my_job)
print(f"Training started: {my_job.id}")

Monitor Training Progress

import time
from seeme.types import JobStatus

while True:
    my_job = client.get_job(my_job.id)
    print(f"Status: {my_job.status}")

    if my_job.status in [JobStatus.FINISHED, JobStatus.ERROR]:
        break

    time.sleep(30)

if my_job.status == JobStatus.FINISHED:
    print(f"Model created: {my_job.model_id}")

Step 6: Make Predictions

from seeme.types import ApplicationType

# Get your model
model = client.get_model(my_job.model_id)

# Make a prediction
result = client.predict(
    model_id=model.id,
    item="./test-image.jpg",
    application_type=ApplicationType.IMAGE_CLASSIFICATION
)

# Display results
for item in result.inference_items:
    print(f"{item.prediction}: {item.confidence:.2%}")

Batch Predictions

import os

# Predict on multiple images
image_folder = "./test-images/"
for filename in os.listdir(image_folder):
    if filename.endswith(('.jpg', '.png')):
        result = client.predict(
            model_id=model.id,
            item=os.path.join(image_folder, filename),
            application_type=ApplicationType.IMAGE_CLASSIFICATION
        )
        top = result.inference_items[0]
        print(f"{filename}: {top.prediction} ({top.confidence:.2%})")

Complete Example

Here’s everything in one script:

from seeme import Client
from seeme.types import (
    Dataset, DatasetContentType, Job, JobType, JobItem,
    ValueType, Framework, ApplicationType, JobStatus
)
import time

# Initialize
client = Client(username="your-username", apikey="your-api-key")

# Create dataset
my_dataset = Dataset(
    name="Cat vs Dog Classifier",
    content_type=DatasetContentType.IMAGES,
    default_splits=True
)
my_dataset = client.create_dataset(my_dataset)

# Upload data (assumes ZIP with cats/ and dogs/ folders)
version = client.get_dataset_versions(my_dataset.id)[0]

client.upload_dataset_version(
    dataset_id=my_dataset.id,
    dataset_version_id=version.id,
    folder=".",
    filename="training-data.zip"
)

# Get the application_id
application_id = client.get_application_id(
    base_framework=Framework.PYTORCH,
    framework=Framework.FASTAI,
    base_framework_version="2.1.0",
    framework_version="2.7.13",
    application=ApplicationType.IMAGE_CLASSIFICATION
)

# Train model
my_job = Job(
    name="Train cat vs dog",
    job_type=JobType.TRAINING,
    application_id=application_id,
    dataset_id=my_dataset.id,
    dataset_version_id=version.id,
    items=[
        JobItem(name="nb_epochs", value="10", value_type=ValueType.INT, label="Number of epochs"),
    ]
)
my_job = client.create_job(my_job)

# Wait for training
while True:
    my_job = client.get_job(my_job.id)
    if my_job.status in [JobStatus.FINISHED, JobStatus.ERROR]:
        break
    time.sleep(30)

# Make prediction
if my_job.status == JobStatus.FINISHED:
    result = client.predict(
        model_id=my_job.model_id,
        item="./test.jpg",
        application_type=ApplicationType.IMAGE_CLASSIFICATION
    )
    for item in result.inference_items:
        print(f"{item.prediction}: {item.confidence:.2%}")

Common Operations Reference

TaskMethod
List datasetsclient.get_datasets()
Get datasetclient.get_dataset(id)
Delete datasetclient.delete_dataset(id)
List modelsclient.get_models()
Get modelclient.get_model(id)
List jobsclient.get_jobs()
Delete jobclient.delete_job(id)
Make predictionclient.predict(model_id, item)

What’s Next?


Video Script Outline

Hook (0:00-0:10) “Add AI to your Python app in under 10 minutes. Let’s build something.”

What You’ll Learn (0:10-0:30)

  • Install the seeme package
  • Authenticate and create a client
  • Upload data and train a model
  • Make predictions in your code

Demo Steps (0:30-7:00)

  1. pip install, show version check (0:30)
  2. Create client, show auth flow (1:00)
  3. Create dataset programmatically (1:45)
  4. Upload ZIP, explain structure (2:30)
  5. Start training job (3:30)
  6. Monitor progress loop (4:30)
  7. Make prediction, show output (5:30)
  8. Show batch prediction example (6:30)

Call to Action (7:00-8:00) “You now have a working AI pipeline in Python. Check out the full SDK docs at docs.seeme.ai for advanced features.”