Skip to main content

EVREN MLOps Platform — Python inference SDK for object detection, classification, and segmentation models.

Project description

evren-sdk

EVREN platformu üzerinde eğitilmiş bilgisayarlı görü modellerine Python'dan çıkarım (inference) yapmanızı sağlayan resmi SDK.

Desteklenen görevler: nesne tespiti, sınıflandırma, segmentasyon, döndürülmüş kutu (OBB), anahtar nokta (keypoint).

pip install evren-sdk

Hızlı Başlangıç

from evren_sdk import EvrenClient

client = EvrenClient(api_key="evren_xxxxx")

result = client.predict("kullanici/model-adi", "foto.jpg", confidence=0.3)

for det in result.predictions:
    print(f"{det.class_name}: %{det.confidence:.0%}  bbox={det.bbox}")

print(f"Çıkarım süresi: {result.inference_ms:.0f} ms")

Kimlik Doğrulama

Platformda Ayarlar → API Anahtarları sayfasından anahtar oluşturun. Anahtar evren_ ön eki ile başlar ve X-API-Key başlığı üzerinden otomatik gönderilir.

# API anahtarı ile (önerilen)
client = EvrenClient(api_key="evren_xxxxx")

# JWT token ile de çalışır (Authorization: Bearer)
client = EvrenClient(api_key="eyJhbGci...")

Tekil Çıkarım

result = client.predict(
    model="kullanici/model-adi",        # slug veya UUID
    image="resim.jpg",                  # dosya yolu, Path veya bytes
    confidence=0.25,                    # minimum güven eşiği
    iou=0.45,                           # NMS IoU eşiği
    image_size=640,                     # giriş boyutu
    classes=["araba", "insan"],         # isteğe bağlı sınıf filtresi
)

model parametresi üç format kabul eder:

Format Açıklama
"owner/slug" Son versiyonu otomatik çözer
"owner/slug:v2.0" Belirli versiyon etiketi
"019cec..." (UUID) Doğrudan versiyon kimliği

Toplu Çıkarım (Batch)

Birden fazla görseli tek istekte GPU batch çıkarımı ile işleyin. Tekil çağrılardan önemli ölçüde hızlıdır.

batch = client.predict_batch(
    model="kullanici/model-adi",
    images=["img1.jpg", "img2.jpg", "img3.jpg"],
    confidence=0.3,
)

for r in batch:
    print(f"{r.count} tespit, {r.inference_ms:.0f} ms")

print(f"Toplam: {batch.total_ms:.0f} ms, {batch.count} görsel")

Model Bilgileri

# Sınıf listesi ve renkleri
info = client.model_classes("kullanici/model-adi")
print(info.architecture)  # "yolo26x"
for cls in info.classes:
    print(f"  {cls.name}: {cls.color}")

# Modelleri listele
for m in client.list_models():
    print(f"{m.full_slug}{m.architecture}")

Ön Yükleme (Warmup)

İlk çıkarım gecikmesini ortadan kaldırmak için modelleri önceden GPU'ya yükleyin.

client.warmup(["kullanici/model-adi", "diger/model"])

Asenkron Kullanım

Aynı API, async/await ile:

import asyncio
from evren_sdk import AsyncEvrenClient

async def main():
    async with AsyncEvrenClient(api_key="evren_xxxxx") as client:
        result = await client.predict("kullanici/model-adi", "foto.jpg")
        batch = await client.predict_batch(
            "kullanici/model-adi",
            ["a.jpg", "b.jpg"],
        )
        print(result.predictions, batch.count)

asyncio.run(main())

Hata Yönetimi

from evren_sdk import (
    EvrenClient, NotFoundError,
    RateLimitError, InferenceError,
)
import time

client = EvrenClient(api_key="evren_xxxxx")

try:
    result = client.predict("kullanici/model", "test.jpg")
except NotFoundError:
    print("Model bulunamadı")
except RateLimitError as e:
    time.sleep(e.retry_after)
except InferenceError:
    print("GPU sunucusu geçici olarak kullanılamıyor")
Exception HTTP Açıklama
AuthenticationError 401, 403 Geçersiz veya süresi dolmuş anahtar
NotFoundError 404 Model veya versiyon bulunamadı
ValidationError 422 Hatalı parametre
RateLimitError 429 İstek limiti aşıldı
InferenceError 502, 503 GPU sunucusu hatası

Veri Modelleri

Sınıf Temel Alanlar
PredictResult predictions, inference_ms, image_width, image_height, count
Prediction class_name, confidence, bbox, color, mask, keypoints, obb
BatchResult results, total_ms, count — iterable
ModelClasses classes, architecture, model_name, imgszin operatörü destekler
ModelInfo id, name, slug, architecture, full_slug
ModelVersion id, version_tag, framework, metrics

Gereksinimler

  • Python ≥ 3.10
  • httpx ≥ 0.27

Lisans

Apache License 2.0

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

evren_sdk-0.3.0.tar.gz (7.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

evren_sdk-0.3.0-py3-none-any.whl (8.4 kB view details)

Uploaded Python 3

File details

Details for the file evren_sdk-0.3.0.tar.gz.

File metadata

  • Download URL: evren_sdk-0.3.0.tar.gz
  • Upload date:
  • Size: 7.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for evren_sdk-0.3.0.tar.gz
Algorithm Hash digest
SHA256 e9ddbfb21bf28fe6ac2e086c29a3605654f9f809868a1d7f88949af0f1c7b6a5
MD5 28d3194306a77d5fd1ce512d0c056673
BLAKE2b-256 7ada2374eb818d7eb90eabcc079938e314cf1a95c2ca6cb49834bc31e96731a8

See more details on using hashes here.

File details

Details for the file evren_sdk-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: evren_sdk-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 8.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for evren_sdk-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c2436260579bbeed18ee0605b7900dd26082eb86b8218490411e2dd534efd9ee
MD5 2718a14d15a7b49028b2c66cd47456bd
BLAKE2b-256 9ad42323d97eac358da8b4847cc731e84a834fcc44ebfdcf1c81872eee1e607c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page