forked from apache/predictionio
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Justin Yip
committed
Sep 12, 2014
1 parent
4c66ff5
commit fefb06f
Showing
3 changed files
with
97 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
""" | ||
Import simple query for getting itemrank | ||
""" | ||
import predictionio | ||
import argparse | ||
import time | ||
|
||
|
||
def send_queries(apiurl): | ||
client = predictionio.PredictionClient(threads=1, apiurl=apiurl) | ||
|
||
# Sync Query | ||
query = { | ||
"uid": "u2", | ||
"items": ["i0", "i1", "i2", "i3"], | ||
} | ||
response = client.send_query(query) | ||
print(response) | ||
|
||
# Async Query | ||
query = { | ||
"uid": "u9527", | ||
"items": ["i0", "i1", "i2", "i3"], | ||
} | ||
response = client.asend_query(query) | ||
print(response.get_response()) | ||
|
||
client.close() | ||
|
||
|
||
def main(): | ||
parser = argparse.ArgumentParser(description="some description here..") | ||
parser.add_argument('--apiurl', default="http:https://localhost:8000") | ||
|
||
args = parser.parse_args() | ||
print args | ||
|
||
send_queries(apiurl=args.apiurl) | ||
|
||
if __name__ == '__main__': | ||
main() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters