Skip to content

Commit

Permalink
added initial generated source code
Browse files Browse the repository at this point in the history
  • Loading branch information
cfregly committed Dec 11, 2016
1 parent 426b5a0 commit af17dbb
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
11 changes: 11 additions & 0 deletions prediction.ml/codegen/data/equals/equals.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@

private String str;

public void initialize(Map<String, Object> args) {
}

public Object predict(Map<String, Object> inputs) {
String id = (String)inputs.get("id");

return id.equals("21619");
}
22 changes: 22 additions & 0 deletions prediction.ml/codegen/data/httpclient/httpclient.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@

public Map<String, Object> data = new HashMap<String, Object>();

public void initialize(Map<String, Object> args) {
data.put("url", "http://demo.pipeline.io:9040/prediction/");
}

public Object predict(Map<String, Object> inputs) {
try {
String userId = (String)inputs.get("userId");
String itemId = (String)inputs.get("itemId");
String url = data.get("url") + "/" + userId + "/" + itemId;

return org.apache.http.client.fluent.Request
.Get(url)
.execute()
.returnContent();

} catch(Exception exc) {
throw new RuntimeException(exc);
}
}

0 comments on commit af17dbb

Please sign in to comment.