Skip to content

A Spark Java REST API for Graphene, suitable for a large number of concurrent requests

License

Notifications You must be signed in to change notification settings

NPCai/REST-graphene

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

REST Graphene

A Spark Java REST API for Graphene, suitable for a large number of concurrent requests. It provides a simple wrapper around Graphene Core:

public class App {
	public static void main(String[] args) throws IOException {
		int maxThreads = 64;
		threadPool(maxThreads);
		post("/extract", (req, res) -> {
			return (new Graphene()).doRelationExtraction(req.body(), false, false).serializeToJSON();
		});
	}
}

Why?

The official graphene server was failing when hit with too many requests. I couldn't understand their graphene-server codebase enough to fix the issue.

Install

Install graphene:

git clone https://github.com/Lambda-3/Graphene.git
cd Graphene
touch conf/graphene.conf
./install-SentenceSimplification.sh 
./install-DiscourseSimplification.sh
mvn clean install -DskipTests

Install REST Graphene:

git clone https://github.com/NPCai/REST-graphene.git
cd REST-graphene
mvn clean install
mvn package
mvn exec:java

To ensure it works:

curl -X POST -d "Although the Treasury will announce details of the November refunding on Monday, the funding will be delayed if Congress and President Bush fail to increase the Treasury's borrowing capacity." "http://localhost:4567/extract"

About

A Spark Java REST API for Graphene, suitable for a large number of concurrent requests

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages