This service uses DeOldify to perform automatic image colorization.
It is part of our third party DNN Model Services.
- Python 3.6.5
- SNET CLI
- Pre-trained model (
ColorizeArtistic_gen.pth
)
Clone this repository and download the models using the get_colorize_model.sh
script:
$ git clone https://github.com/singnet/dnn-model-services.git
$ cd dnn-model-services/utils
$ ./get_colorize_model.sh
$ ls -la Resources/Models
total 249188
drwxrwxr-x 2 ci ci 4096 Mar 24 13:30 ./
drwxrwxr-x 5 ci ci 4096 Mar 24 13:29 ../
-rw-rw-r-- 1 ci ci 255144681 Mar 24 13:30 ColorizeArtistic_gen.pth
-rw-rw-r-- 1 ci ci 9210 Mar 24 13:30 watermark.png
$ cd ../services/deoldify-colorizer
To get the ORGANIZATION_ID
and SERVICE_ID
you must have already published a service (check this link).
Create the SNET Daemon
's config JSON file (snetd.config.json
).
{
"DAEMON_END_POINT": "DAEMON_HOST:DAEMON_PORT",
"IPFS_END_POINT": "http://ipfs.singularitynet.io:80",
"BLOCKCHAIN_NETWORK_SELECTED": "BLOCKCHAIN_NETWORK",
"PASSTHROUGH_ENDPOINT": "http://SERVICE_GRPC_HOST:SERVICE_GRPC_PORT",
"ORGANIZATION_ID": "ORGANIZATION_ID",
"SERVICE_ID": "SERVICE_ID",
"LOG": {
"LEVEL": "debug",
"OUTPUT": {
"TYPE": "stdout"
}
}
}
For example (using the Ropsten testnet):
$ cat snetd.config.json
{
"DAEMON_END_POINT": "0.0.0.0:7085",
"IPFS_END_POINT": "http://ipfs.singularitynet.io:80",
"BLOCKCHAIN_NETWORK_SELECTED": "ropsten",
"PASSTHROUGH_ENDPOINT": "http://localhost:7003",
"ORGANIZATION_ID": "snet",
"SERVICE_ID": "deoldify-colorizer",
"LOG": {
"LEVEL": "debug",
"OUTPUT": {
"TYPE": "stdout"
}
}
}
Note that we set DAEMON_HOST = 0.0.0.0
because this service will run inside a Docker container.
Install all dependencies:
$ pip3 install -r requirements.txt
Generate the gRPC codes:
$ sh buildproto.sh
Start the service and SNET Daemon
:
$ python3 run_service.py
Inputs:
gRPC method
: colorize.img_input
: An image URL.
Local (testing purpose):
$ python3 test_service.py
Endpoint (localhost:7003):
Method (colorize): colorize
Image (Link): https://snet-models.s3.amazonaws.com/bh/Colorize/jucelino.jpg
[Base64 Image]
Through SingularityNET (follow this link to learn how to publish a service and open a payment channel to be able to call it):
Assuming that you have an open channel to this service:
$ snet client call snet deoldify-colorizer default_group colorize '{"img_input": "https://snet-models.s3.amazonaws.com/bh/Colorize/carnaval.jpg"}'
[Base64 Image]
Please read our guidelines before submitting an issue. If your issue is a bug, please use the bug template pre-populated here. For feature requests and queries you can use this template.
- Artur Gontijo - Maintainer - SingularityNET