Skip to main content

Prediction API client for Python

Project description

prediction-api

  • App will receive an HTTP POST call in this format
curl -X POST
    -H 'Authorization: Key API_KEY'
    -H "Content-Type: application/json"
    -d '
    {
      "inputs": [
        {
          "data": {
            "image": {
              "url": "https://lh3.googleusercontent.com/GNE-0Vga-Uffz1i9oxP0ueYYvPW8qG_z7_IlQX3yCqPNILam2Z-rlkYzjoRGkPp74XeEkVb96r1-N1-yRKGhvkFQK5uI=s256"
            }
          }
        }
      ]
    }'
    https://prediction-api-dot-platform-ai-dev.appspot.com/v1/project?id=ahFzfnBsYXRmb3JtLWFpLWRldnJTCxIEVXNlciIcMGFXdExZREhlU1puZ3F1SUxpYXUzQ0NFQ1FFMgwLEgdQcm9qZWN0IiA2MmEwMjYyYjNiYTI0NDA4OGNlYTgyYjg0MTQ1MDg3Mww
  • Since this is a multi-tenant application and we cannot redploy it (or use the same key for multi customers), in order to turn on a new tenant, API keys need to be managed in Google Data Store. Project type in Datastore has a reference to valid API keys that can access it for prediction.

  • Import model_utilities from platform-ai package (TBD)

    model = get_model(project_id)
    model.predict_from_url(URL) returns prediction json

  • cache the model in memorystore for future requests, backend will invalidate this cache if/when the model is retrained

Error codes

  • Bad URL / not accessible
  • project_id invalid
  • rate limit exceeded
  • no trained model is available
  • backend error / something blew up

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

platformai-0.0.1.tar.gz (2.4 kB view details)

Uploaded Source

Built Distribution

platformai-0.0.1-py3-none-any.whl (3.1 kB view details)

Uploaded Python 3

File details

Details for the file platformai-0.0.1.tar.gz.

File metadata

  • Download URL: platformai-0.0.1.tar.gz
  • Upload date:
  • Size: 2.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.18.4 setuptools/39.1.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.5

File hashes

Hashes for platformai-0.0.1.tar.gz
Algorithm Hash digest
SHA256 973515529fee1977d852881a6a9336d583ea09863216e17648c9671e0b96d7b4
MD5 d391cf668d0edfc942dc637a1a5e9053
BLAKE2b-256 3bfc364524b7364c0f12f3fe419318b083600113d5c84964740362bbbf051f75

See more details on using hashes here.

File details

Details for the file platformai-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: platformai-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 3.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.18.4 setuptools/39.1.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.5

File hashes

Hashes for platformai-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d764b465a798e98a5768327aae508b80e94a19bac1df1275010fe707d0395625
MD5 fd94701c645c75b60e430a0707b79cc4
BLAKE2b-256 037eb0ff98f07fe8c4b6bcbdc759bd55ec510d494b9aeb9d51664af6fe84e3be

See more details on using hashes here.

Supported by

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