Skip to main content

TODO

Project description

Hyped Serve

Hyped Serve is a lightweight add-on for hyped designed to streamline the serving process of a hyped data pipeline.

Installation

You can install the add-on directly from PyPI using pip:

pip install hyped-serve

Getting Started

Hyped Serve leverages the power of FastAPI to create a robust serving environment.

To get started, simply define your data pipeline and its expected input features in a Python script, and then serve it using hyped.serve.

Here's a basic example:

# app.py
from hyped.serve import HypedAPI
from hyped.data.pipe import DataPipe
from datasets import Features

# Define your data pipeline and its expected input features
pipe = DataPipe([...])
features = Features({...})

# Create the app to be served
app = HypedAPI().serve_pipe(pipe, features, prefix="/")

Once you've defined your app, you can serve it using uvicorn:

uvicorn app:app --host 0.0.0.0 --port 80

This will start the server, allowing you to interact with your data pipeline via HTTP requests.

Endpoints

The Hyped Serve API provides the following endpoints for interacting with your data pipeline:

Endpoint Method Description
/health GET Simple health check always returns "ok" and code 200.
<prefix>/ready GET Readiness check to determine if the server is ready to receive requests.
<prefix>/apply POST Process a single example using the data pipeline. Expects a single example in JSON format matching the specified features.
<prefix>/batch POST Process a batch of examples using the data pipeline. Expects a list of examples.

Additionally, a Swagger UI API documentation is available at /docs.

Serving multiple Data Pipes

The serving environment also supports serving multiple data pipes simultaneously. You can configure this by providing multiple data pipes and their respective features.

# app.py

app = (
    HypedAPI()
    .serve_pipe(pipe_one, features_one, prefix="/one")
    .serve_pipe(pipe_two, features_two, prefix="/two")
)

This example demonstrates serving two different data pipes (pipe_one and pipe_two) with their corresponding features, each accessible via different prefixes (/one and /two).

Running Tests

Hyped Serve includes a suite of tests to ensure its functionality. You can run these tests using pytest:

pytest tests

Ensure that you have pytest installed in your environment. You can install it via pip:

pip install pytest

Running the tests will execute various test cases to validate the behavior of Hyped Serve.

License

Hyped Serve is licensed under the Apache License 2.0. See the LICENSE file for details.

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

hyped_serve-0.1.0.tar.gz (11.4 kB view hashes)

Uploaded Source

Built Distribution

hyped_serve-0.1.0-py3-none-any.whl (9.2 kB view hashes)

Uploaded Python 3

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