Skip to content

Latest commit

 

History

History
106 lines (55 loc) · 2.36 KB

README.md

File metadata and controls

106 lines (55 loc) · 2.36 KB

Model API Usage Guide

Welcome to our model API! This guide provides instructions on how to interact with our deployed machine learning model to obtain predictions and recommendations.

Overview

Our model is hosted as a RESTful service and can be accessed via standard HTTP methods. Currently, the following endpoints are available:

  • /predict: Obtain predictions based on input features.
  • /recommend: Get top-n item recommendations for a user.

Requirements

To use the API, you'll need an HTTP client to make requests. This could be a tool like curl on the command line, libraries like requests in Python, or any other HTTP client capable of making POST requests with JSON data.

Deployment

To deploy the API, you need to unzip the data.zip to /data folder, and unzip the params.zip in the / folder and run app.py

And run

pip install -r requirements.txt

if you find there are any package that is not installed, pleas install it manually, e.g.

pip install <package_name>

Endpoints

Predict Endpoint

To obtain a prediction, send a POST request with the appropriate JSON payload to the /predict endpoint.

URL: http://5000/predict

Method: POST

Payload Example:

{ "feature1": "value1", "feature2": "value2", // ... other required features }

Response Example:

{ "prediction": "predicted_value" }

Recommend Endpoint

To receive item recommendations, send a POST request with user details to the /recommend endpoint.

URL: http://5000/recommend

Method: POST

Payload Example:

{ "user_id": 123, // ... other user details if needed }

Response Example:

{ "recommendation": ["item1", "item2", "item3", ...] }

Usage

Here's an example of how to use curl to interact with the predict endpoint:

curl -X POST http://5000/predict
-H "Content-Type: application/json"
-d '{"feature1": "value1", "feature2": "value2"}'

Error Handling

If there's an issue with the request, the API will return an error message with an appropriate HTTP status code. For example:

  • 400 Bad Request: Check if the JSON payload is correctly formatted and includes all required fields.
  • 500 Internal Server Error: An error occurred on the server. Please try again later or contact support.

Support

For any additional help or support, please reach out to support@example.com.