Quick Start
This guide details the steps needed to install or update the Portal SDK for Python. This library supports Python 3.8 or later.
Installation
Submit a Job
import asyncio
import logging
from faceware.pyportal.job import TrackingModel, VideoRotation
from faceware.pyportal.job_result import JobStatus
from faceware.pyportal import PortalClient
# set your desired logging level
logging.basicConfig(level=logging.INFO)
client = PortalClient(
access_token="{YOUR-ACCESS-TOKEN}",
organization_id="{YOUR-ORGANIZATION-ID}",
parent_logger=logging.getLogger("pyportal") # Optional
)
async def main():
project = await client.get_project("{PROJECT-ID}")
job = await project.submit_job(
actor_name="Sample",
tracking_model=TrackingModel.HEAD_CAM,
video_file_path="samples/Video.mp4",
video_rotation=VideoRotation.ROTATE_90,
calibration_image_file_path="samples/Calibration.jpg"
)
while await job.get_status() not in [JobStatus.COMPLETED, JobStatus.FAILED]:
print("waiting for job status to change")
if job.status is JobStatus.COMPLETED:
await job.download_retargeting_file("samples/tracked.fwr")
asyncio.run(main())