Skip to content

Commit

Permalink
chore(ogbv-ml-rest): cleanup docs
Browse files Browse the repository at this point in the history
  • Loading branch information
dennyabrain authored Jul 7, 2022
1 parent 71ede9d commit 50938e6
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions ogbv-ml-rest/README.md
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"
```

0 comments on commit 50938e6

Please sign in to comment.