Implementing a web service
As we mentioned in the previous section, SparkJava can be used to quickly implement a REST API. The example web application we implemented in the previous section is monolithic, but looking back at its source code, we can notice how easily it would be to separate the frontend from the backend and move this to a REST API.
The frontend client presenting a form for image submission could be implemented with any web frontend framework. The client would then make a call to a REST service that's implemented through SparkJava, which performs the inference with the VGG16 model and finally returns the prediction results in JSON format. Let's see how easy it is to implement this service, starting from the existing code for ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access