Skip to content

Python SDK

revieve-sdk — a thin, typed client for analyze_image. Source lives in sdks/python/.

Terminal window
pip install revieve-sdk

Requires Python 3.10+. Depends on httpx.

from revieve import SkinAnalysisClient
revieve = SkinAnalysisClient(partner_id="jmlv6b2qtS")
with open("selfie.jpg", "rb") as f:
result = revieve.analyze_image(
image=f,
components=["wrinkles", "redness", "skin_age"],
gender="unknown",
skintone=0,
)
print(result["message"], len(result["results"]))
from revieve import RevieveAnalysisError, RevieveNetworkError
try:
result = revieve.analyze_image(image=f)
except RevieveAnalysisError as err:
print(err.first_error_idx, err)
except RevieveNetworkError:
raise

The v0.1 client is synchronous. An AsyncSkinAnalysisClient is on the roadmap; in the meantime, run sync calls in a thread pool from your async app:

import asyncio
import functools
async def analyze(image_path: str):
return await asyncio.to_thread(
functools.partial(revieve.analyze_image, image=open(image_path, "rb"))
)

Pass a configured httpx.Client for unit testing, retries, or proxies:

import httpx
mock = httpx.Client(transport=httpx.MockTransport(handler))
revieve = SkinAnalysisClient(partner_id="test", http_client=mock)