Metadata-Version: 2.1
Name: meteorite
Version: 0.1.0
License-File: LICENSE
Summary: A fast and simple web server for machine learning models
Keywords: model,server,api,hosting
Maintainer-email: Utkarsh Goel <utkarsh@deploif.ai>, Sean Chok <seanchok@deploif.ai>
Requires-Python: >=3.7
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM

# ☄️ Meteorite

A fast and simple web server to host your Machine Learning model.

<!-- TOC -->

- [☄️ Meteorite](#-meteorite)
  - [Install the pip package](#install-the-pip-package)
  - [Write your server](#write-your-server)
  - [Project status](#project-status)
  - [Contribute to ☄️ Meteorite](#contribute-to--meteorite)
  <!-- TOC -->

## Install the pip package

```shell
pip install meteorite
```

## Write your server

```python
import json
import meteorite

app = meteorite.Meteorite()
app.set_webhook_url("https://testapp.via.routehead.com")

@app.predict
def predict(data):
    body = data.decode("utf-8")
    """
    Run your model on the input
    """
    return body

app.start(port=4000) # port is 4000 by default
```

By default, the server starts at port `4000`. The `predict` function will run with GET/POST requests on `/predict`.

## Get your result: a webhook

The `set_webhook_url` function has been added to the Meteorite API to get responses from prediction requests. This makes Meteorite suitable for use in long-running ML tasks.

### The webhook URL 

Your webhook URL must accept a POST request at the specific route. The result JSON will be sent as body of the request.

## Project status

This project is under active development. We will not recommend you to use this package for critical applications.
We will welcome all contributions! Please refer to the contributions section for more details.

Some of the features we're still working on:

- [x] Pass POST request String and JSON into the Python function.
- [x] Return String and JSON with the correct content type headers.
- [x] Graceful error handling (⚠️ Priority).
- [x] Customise the port for the server
- [ ] Allow more datatypes for POST request to the model.
- [ ] Create more examples.

## Contribute to ☄️ Meteorite

Please refer to the [CONTRIBUTING.md](CONTRIBUTING.md) docs for details.

[Join our Discord channel](https://discord.gg/qXTn7cZzrZ) if you have more questions.

