A minimal Flask web application.
These instructions will help you get your API up and running.
- Node.js installed
- npm (Node Package Manager) installed
- axios library installed (you can install it using
npm install axios
)
const axios = require('axios');
async function makePrediction(commentText) {
try {
const response = await axios.post('https://flask-production-b980.up.railway.app/predict', {'comment': commentText});
const responseData = response.data;
console.log('Prediction:', responseData);
} catch (error) {
console.error('Error making prediction:', error.message);
}
}
// Example usage
const commentText = 'This is a sample comment.';
makePrediction(commentText);
Document the available endpoints, request parameters, and response format
- POST /predict
- comment (string): The text comment for prediction.
- result (bool): The prediction result.
{ "result": true }
For a step-by-step guide to deploying on Railway, see this post, or click the button below.