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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for hyped_serve-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7b4e9b806e4e6332289b0cafe4cc4ad3d09d07bba242194a8d5409dae9d2f9af |
|
MD5 | bc8f77da81ffe438dab7b3dcce3bdfbe |
|
BLAKE2b-256 | d0445dd03cb42edb96494d5c87d5de7ac4e493d04b5b82970f17111b9987f71a |