|
Java example source code file (FlowResource.java)
The FlowResource.java Java example source codepackage org.deeplearning4j.ui.flow; import org.deeplearning4j.ui.flow.beans.ModelInfo; import org.deeplearning4j.ui.flow.beans.NodeReport; import org.deeplearning4j.ui.storage.SessionStorage; import org.deeplearning4j.ui.storage.def.ObjectType; import javax.ws.rs.*; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import java.util.Collections; import java.util.concurrent.locks.ReentrantReadWriteLock; /** * Almost RESTful interface for FlowIterationListener. * * @author raver119@gmail.com */ @Path("/flow") public class FlowResource { private SessionStorage storage = SessionStorage.getInstance(); @GET @Path("/state") @Produces(MediaType.APPLICATION_JSON) public Response getState(@QueryParam("sid") String sessionId) { // TODO: to be improved with HistoryStorage ModelInfo model = (ModelInfo) storage.getObject(sessionId, ObjectType.FLOW); return Response.ok(model).build(); } @POST @Path("/state") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) public Response postState(ModelInfo info, @QueryParam("sid") String sessionId) { storage.putObject(sessionId, ObjectType.FLOW, info); return Response.ok(Collections.singletonMap("status","ok")).build(); } @GET @Path("/action/{id}") @Produces(MediaType.TEXT_HTML) public Response getAction(@PathParam("id") long id) { // TODO: to be implemented // TODO: not sure, if we need this to be TEXT_HTML though. Investigate options. return Response.ok().build(); } @POST @Path("/action/{id}") @Consumes(MediaType.APPLICATION_JSON) public Response postState(@PathParam("id") long id, NodeReport report) { // TODO: to be implemented return Response.ok().build(); } } Other Java examples (source code examples)Here is a short list of links related to this Java FlowResource.java source code file: |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.