bat.apis API documentation

# bat.apis

This module implements several API clients for Deep Learning cloud API services, so that we can use `model.predict()` to get prediction results from API servers.

- DeepAPI

    from bat.apis.deepapi import DeepAPI_VGG16_Cifar10

    # Load Image
    x = np.sarray(Image.open("dog.jpg"))
    x = np.array([x])

    # Initialize API Model
    model = DeepAPI_VGG16_Cifar10("http://localhost:8080" )

    # Get Preditctions
    y_pred = model.predict(np.array([x]))[0]

    # Print Predictions
    model.print(y_pred)

- Google Cloud Vision

    from bat.apis.google import CloudVision

    # Initialize API Model
    model = CloudVision()

    # Get Preditctions
    y_pred = model.predict("dog.jpg")

    # Print Predictions
    model.print(y_pred)

- Imagga

    from bat.apis.imagga import Imagga

    # Initialize API Model
    api_key = input(f"Please input the Imagga API Key: ")
    api_secret = input(f"Please input the Imagga API Secret: ")

    model = Imagga(api_key, api_secret, concurrency=2)

    # Get Preditctions
    y_pred = model.predict("dog.jpg")

    # Print Predictions
    model.print(y_pred)

View Source

     1r'''
     2This module implements several API clients for Deep Learning cloud API services, so that we can use `model.predict()` to get prediction results from API servers.
     3
     4- [DeepAPI](https://github.com/wuhanstudio/deepapi)
     5
     6```python
     7from bat.apis.deepapi import DeepAPI_VGG16_Cifar10
     8
     9# Load Image
    10x = np.sarray(Image.open("dog.jpg"))
    11x = np.array([x])
    12
    13# Initialize API Model
    14model = DeepAPI_VGG16_Cifar10("http://localhost:8080" )
    15
    16# Get Preditctions
    17y_pred = model.predict(np.array([x]))[0]
    18
    19# Print Predictions
    20model.print(y_pred)
    21```
    22
    23- [Google Cloud Vision](https://cloud.google.com/vision)
    24
    25```python
    26from bat.apis.google import CloudVision
    27
    28# Initialize API Model
    29model = CloudVision()
    30
    31# Get Preditctions
    32y_pred = model.predict("dog.jpg")
    33
    34# Print Predictions
    35model.print(y_pred)
    36```
    37
    38- [Imagga](https://docs.imagga.com/#tags)
    39
    40```python
    41from bat.apis.imagga import Imagga
    42
    43# Initialize API Model
    44api_key = input(f"Please input the Imagga API Key: ")
    45api_secret = input(f"Please input the Imagga API Secret: ")
    46
    47model = Imagga(api_key, api_secret, concurrency=2)
    48
    49# Get Preditctions
    50y_pred = model.predict("dog.jpg")
    51
    52# Print Predictions
    53model.print(y_pred)
    54```
    55
    56'''
    57
    58from bat.apis import deepapi
    59from bat.apis import google
    60from bat.apis import imagga