This PR implements the API script api_test.py to handle requests from the frontend and run the machine learning model defined in train.py. The API script provides an interface for the frontend to interact with the backend and obtain predictions from the machine learning model.
Summary of Changes
Created a new file api_test.py to contain the API script.
Imported the necessary modules flask and torch for handling requests and running the machine learning model.
Imported the CNN class from train.py to load the trained model parameters.
Defined a POST route in the API script to receive data from the frontend, process the data, run the machine learning model, and return the results as JSON.
Added logic to run the Flask application if the script is run directly.
Please review and merge this PR to enable the API functionality and allow the frontend to interact with the machine learning model.
Fixes #238.
To checkout this PR branch, run the following command in your terminal:
git checkout sweep/api-script
To get Sweep to edit this pull request, leave a comment below or in the code. Leaving a comment in the code will only modify the file but commenting below can change the entire PR.
Description
This PR implements the API script
api_test.py
to handle requests from the frontend and run the machine learning model defined intrain.py
. The API script provides an interface for the frontend to interact with the backend and obtain predictions from the machine learning model.Summary of Changes
api_test.py
to contain the API script.flask
andtorch
for handling requests and running the machine learning model.CNN
class fromtrain.py
to load the trained model parameters.POST
route in the API script to receive data from the frontend, process the data, run the machine learning model, and return the results as JSON.Please review and merge this PR to enable the API functionality and allow the frontend to interact with the machine learning model.
Fixes #238.
To checkout this PR branch, run the following command in your terminal:
To get Sweep to edit this pull request, leave a comment below or in the code. Leaving a comment in the code will only modify the file but commenting below can change the entire PR.