Providing AI Services via Blockchain
A Dopamine.ai Code Sample
In our last post, we presented a simple overview of Dopamine’s infrastructure using a classic “Hello World” implementation.
Now, we’re excited to dig deeper into what Dopamine is all about by giving an example of an AI inference service trade. Our code remains simple and clear, but what it represents is far from basic. Check it out below:
The Sample Scenario
Our example gives an overview of a scenario in which a buyer “B” purchases an AI service from the seller “A”. To keep things simple, we did not include the usage of Dopamine certificates and we assume that both sides know one another’s address.
The service that is being purchased in this scenario is classification of a specific image (a lion, in our example). We use a pre-trained VGG model to make this identification (downloaded via the tensorflow library).
Our Bootcamp page walks the user through the steps required to initiate the service on the buyer side, which are similar to the “Hello World” case: create a session, a service descriptor and a reward descriptor. Then, the whole process of getting the service in exchange for DOPA tokens is done in a single line:
The process is extremely streamlined, making this feature quite easy to implement.
The seller is trading the image classification service we described above in exchange for 100 DOPA weis. On this side too, the Dopamine workflow is very similar to the “Hello World” case: describe the service , create quote, and wait for buyers. We wait and are in luck: we get a buyer for our very nifty image classification service.
In our next code sample we will show how AI teaching services can be implemented on the Dopamine network. Stay tuned…