-
-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
71ede9d
commit 50938e6
Showing
1 changed file
with
8 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,24 @@ | ||
# Go through the following steps to run the server using docker locally: | ||
# OGBV ML REST Server | ||
|
||
## 1. Clone the repository in your local machine and navigate to the 'FastAPI - OGBV' folder. | ||
## 2. Run the following command to build the docker. Note that if you are on a Windows machine, you will need to change the file format of the 'download_model' file to 'unix'. More information on this can be found [here](https://tanutaran.medium.com/solving-git-lf-will-be-replaced-by-crlf-7ca84eb0aad4) and [here](https://stackoverflow.com/questions/19425857/env-python-r-no-such-file-or-directory). | ||
## Developing Locally | ||
|
||
1. Clone the repository in your local machine and navigate to the 'FastAPI - OGBV' folder. | ||
2. Run the following command to build the docker. Note that if you are on a Windows machine, you will need to change the file format of the 'download_model' file to 'unix'. More information on this can be found [here](https://tanutaran.medium.com/solving-git-lf-will-be-replaced-by-crlf-7ca84eb0aad4) and [here](https://stackoverflow.com/questions/19425857/env-python-r-no-such-file-or-directory). | ||
|
||
``` | ||
docker build -t ml . | ||
``` | ||
## 3. After your docker is built, run it using the following command | ||
3. After your docker is built, run it using the following command | ||
``` | ||
docker run -p 8080:80 ml | ||
``` | ||
|
||
## 4. Test the API endpoint by running the following command: | ||
4. Test the API endpoint by running the following command: | ||
|
||
``` | ||
curl -X POST http://localhost:8080/predict -H 'Content-Type: application/json' -d '{"text":"The food in this restaurant is disgusting"}' | ||
``` | ||
### Note that if you are on windows and are using PowerShell, you might need to run this command instead of the previous one for making POST requests: | ||
Note that if you are on windows and are using PowerShell, you might need to run this command instead of the previous one for making POST requests: | ||
``` | ||
Invoke-RestMethod -Method 'Post' -Uri http://localhost:8080/predict -Body (@{"text"="The food in this restaurant is disgusting"}|ConvertTo-Json) -ContentType "application/json" | ||
``` |