Skip to content

makefile/py4j-rpc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Py4j-RPC

Py4j-RPC is a simple bridge that enables Java VM call Python codes through TCP connection between Java and python side. And it uses protocal of JSON-RPC.

It can be used as a simple way to run Python services for Java, such as Keras, PyTorch libraries for deep learning. The thing you need to notice is that the params to send is basic type. There is a walkaround if you need numpy array in python, put the data in a 1-dim array as Python function's param,then reshape and copy to numpy array.

This is a maven project that depend on JSON-RPC-2.0 java library, and optionally Jython for fun.

Usage

  • python side: run python JsonRPC-stream-server.py this will listen on host and serve some functions which will be called in Java side.
  • java side: see Main.java

Other repo that might be useful:

About

Run Python code in Java through RPC way.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published