Эх сурвалжийг харах

Add README section for API

jqueguiner 6 жил өмнө
parent
commit
6822b071ab
1 өөрчлөгдсөн 29 нэмэгдсэн , 5 устгасан
  1. 29 5
      README.md

+ 29 - 5
README.md

@@ -215,7 +215,7 @@ jupyter lab
 
 
 From there you can start running the notebooks in Jupyter Lab, via the url they provide you in the console.  
 From there you can start running the notebooks in Jupyter Lab, via the url they provide you in the console.  
 
 
-#### Docker
+#### Docker for Jupyter
 
 
 You can build and run the docker using the following process:
 You can build and run the docker using the following process:
 
 
@@ -226,18 +226,43 @@ git clone https://github.com/jantic/DeOldify.git DeOldify
 
 
 Building Docker
 Building Docker
 ```console
 ```console
-cd DeOldify && docker build -t deoldify .
+cd DeOldify && docker build -t deoldify_jupyter -f Dockerfile .
 ```
 ```
 
 
 Running Docker
 Running Docker
 ```console
 ```console
-echo "http://$(curl ifconfig.io):8888" && nvidia-docker run --ipc=host --env NOTEBOOK_PASSWORD="pass123" -p 8888:8888 -it deoldify
+echo "http://$(curl ifconfig.io):8888" && nvidia-docker run --ipc=host --env NOTEBOOK_PASSWORD="pass123" -p 8888:8888 -it deoldify_jupyter
 ```
 ```
 
 
+#### Docker for API
+
+You can build and run the docker using the following process:
+
+Cloning
+```console
+git clone https://github.com/jantic/DeOldify.git DeOldify
+```
+
+Building Docker
+```console
+cd DeOldify && docker build -t deoldify_api -f Dockerfile-api .
+```
+
+Running Docker
+```console
+echo "http://$(curl ifconfig.io):5000" && nvidia-docker run --ipc=host -p 5000:5000 -it deoldify_api
+```
+
+Calling the API
+```console
+curl -X POST "http://MY_SUPER_API_IP:5000/process" -H "accept: image/png" -H "Content-Type: application/json" -d "{\"source_url\":\"http://www.afrikanheritage.com/wp-content/uploads/2015/08/slave-family-P.jpeg\", \"render_factor\":35}" --output colorized_image.png
+```
+
+#### Note Regarding Docker
 If you don't have Nvidia Docker, here is the installation guide :
 If you don't have Nvidia Docker, here is the installation guide :
 https://github.com/nvidia/nvidia-docker/wiki/Installation-(version-2.0)#installing-version-20
 https://github.com/nvidia/nvidia-docker/wiki/Installation-(version-2.0)#installing-version-20
 
 
-#### Note 
+#### Note GIT LFS (test images download support)
 Make sure you have Git LFS installed if you're planning on using images in the /test_images/ folder.  Otherwise, you'll just wind up getting tiny files that will have the same file names but you will run into errors trying to open them or colorize them.  If you have a fancy shmancy git client like GitHub Desktop, it will probably prompt you to install it and do it for you.  If that doesn't happen,  get it here: https://git-lfs.github.com/
 Make sure you have Git LFS installed if you're planning on using images in the /test_images/ folder.  Otherwise, you'll just wind up getting tiny files that will have the same file names but you will run into errors trying to open them or colorize them.  If you have a fancy shmancy git client like GitHub Desktop, it will probably prompt you to install it and do it for you.  If that doesn't happen,  get it here: https://git-lfs.github.com/
 
 
 --------------------------
 --------------------------
@@ -289,4 +314,3 @@ We suspect some of you are going to want access to the original DeOldify model f
 ### Want More?
 ### Want More?
 
 
 I'll be posting more results on Twitter. [<img src="resource_images/Twitter_Social_Icon_Rounded_Square_Color.svg" width="28">](https://twitter.com/citnaj)
 I'll be posting more results on Twitter. [<img src="resource_images/Twitter_Social_Icon_Rounded_Square_Color.svg" width="28">](https://twitter.com/citnaj)
-