Repository: predictionio-site Updated Branches: refs/heads/asf-site a8216bed0 -> c3b8e903f
http://git-wip-us.apache.org/repos/asf/predictionio-site/blob/c3b8e903/templates/vanilla/quickstart/index.html ---------------------------------------------------------------------- diff --git a/templates/vanilla/quickstart/index.html b/templates/vanilla/quickstart/index.html index d65f7f9..a6f93a4 100644 --- a/templates/vanilla/quickstart/index.html +++ b/templates/vanilla/quickstart/index.html @@ -54,17 +54,17 @@ Your system is all ready to go. </pre></td></tr></tbody></table> </div> <p>When the engine is deployed successfully and running, you should see a console message similar to the following:</p><div class="highlight shell"><table style="border-spacing: 0"><tbody><tr><td class="gutter gl" style="text-align: right"><pre class="lineno">1 2</pre></td><td class="code"><pre><span class="o">[</span>INFO] <span class="o">[</span>HttpListener] Bound to /0.0.0.0:8000 <span class="o">[</span>INFO] <span class="o">[</span>MasterActor] Bind successful. Ready to serve. -</pre></td></tr></tbody></table> </div> <p>Do not kill the deployed engine process.</p><p>By default, the deployed engine binds to <a href="http://localhost:8000"><a href="http://localhost:8000">http://localhost:8000</a></a>. You can visit that page in your web browser to check its status.</p><p><img alt="Engine Status" src="/images/engine-server-3246414b.png"/></p></p><h2 id='6.-use-the-engine' class='header-anchors'>6. Use the Engine</h2><p>Now, You can try to retrieve predicted results. The engine accepts JSON query with the field 'q': <code>{ "q" : "foo" }</code>. A prefix is added to the query data and return as PredictedResult.</p><p>With the deployed engine running, open another terminal and run the following <code>curl</code> command or use SDK to send the query:</p><div class="tabs"> <ul class="control"> <li data-lang="json"><a href="#tab-75828552-63e4-4434-bba0-1851e0c93bcc">REST API</a></li> <li data-lang="python"><a href="#tab-c74972ef-28f5-4f f7-b777-fc2f5834f314">Python SDK</a></li> <li data-lang="php"><a href="#tab-9cef4c2a-be97-4ef9-86dc-5091f1324e1b">PHP SDK</a></li> <li data-lang="ruby"><a href="#tab-5f3cfd21-824e-4ac1-9cdb-bb7d085e5227">Ruby SDK</a></li> <li data-lang="java"><a href="#tab-de04d5cd-e35b-42c0-9adb-e5dbbcce9916">Java SDK</a></li> </ul> <div data-tab="REST API" data-lang="json" id="tab-75828552-63e4-4434-bba0-1851e0c93bcc"> <div class="highlight shell"> <table style="border-spacing: 0"><tbody><tr> <td class="gutter gl" style="text-align: right"><pre class="lineno">1 +</pre></td></tr></tbody></table> </div> <p>Do not kill the deployed engine process.</p><p>By default, the deployed engine binds to <a href="http://localhost:8000"><a href="http://localhost:8000">http://localhost:8000</a></a>. You can visit that page in your web browser to check its status.</p><p><img alt="Engine Status" src="/images/engine-server-3246414b.png"/></p></p><h2 id='6.-use-the-engine' class='header-anchors'>6. Use the Engine</h2><p>Now, You can try to retrieve predicted results. The engine accepts JSON query with the field 'q': <code>{ "q" : "foo" }</code>. A prefix is added to the query data and return as PredictedResult.</p><p>With the deployed engine running, open another terminal and run the following <code>curl</code> command or use SDK to send the query:</p><div class="tabs"> <ul class="control"> <li data-lang="json"><a href="#tab-78ec541b-1843-4ba9-956c-346148ae574f">REST API</a></li> <li data-lang="python"><a href="#tab-cc99e8d6-1332-4c 02-ba7b-91b663693e39">Python SDK</a></li> <li data-lang="php"><a href="#tab-fa03f531-3dbc-4323-a8ff-91ed613c9e89">PHP SDK</a></li> <li data-lang="ruby"><a href="#tab-780739ad-be6e-4e23-97a4-d3fb771b2110">Ruby SDK</a></li> <li data-lang="java"><a href="#tab-f62db435-0b2f-4a0b-95ea-23e7f008d812">Java SDK</a></li> </ul> <div data-tab="REST API" data-lang="json" id="tab-78ec541b-1843-4ba9-956c-346148ae574f"> <div class="highlight shell"> <table style="border-spacing: 0"><tbody><tr> <td class="gutter gl" style="text-align: right"><pre class="lineno">1 2 3</pre></td> <td class="code"><pre><span class="gp">$ </span>curl -H <span class="s2">"Content-Type: application/json"</span> <span class="se">\</span> -d <span class="s1">'{ "q": "foo" }'</span> http://localhost:8000/queries.json -</pre></td> </tr></tbody></table> </div> </div> <div data-tab="Python SDK" data-lang="python" id="tab-c74972ef-28f5-4ff7-b777-fc2f5834f314"> <div class="highlight python"> <table style="border-spacing: 0"><tbody><tr> <td class="gutter gl" style="text-align: right"><pre class="lineno">1 +</pre></td> </tr></tbody></table> </div> </div> <div data-tab="Python SDK" data-lang="python" id="tab-cc99e8d6-1332-4c02-ba7b-91b663693e39"> <div class="highlight python"> <table style="border-spacing: 0"><tbody><tr> <td class="gutter gl" style="text-align: right"><pre class="lineno">1 2 3</pre></td> <td class="code"><pre><span class="kn">import</span> <span class="nn">predictionio</span> <span class="n">engine_client</span> <span class="o">=</span> <span class="n">predictionio</span><span class="o">.</span><span class="n">EngineClient</span><span class="p">(</span><span class="n">url</span><span class="o">=</span><span class="s">"http://localhost:8000"</span><span class="p">)</span> <span class="k">print</span> <span class="n">engine_client</span><span class="o">.</span><span class="n">send_query</span><span class="p">({</span> <span class="s">"q"</span><span class="p">:</span> <span class="s">"foo"</span> <span class="p">})</span> -</pre></td> </tr></tbody></table> </div> </div> <div data-tab="PHP SDK" data-lang="php" id="tab-9cef4c2a-be97-4ef9-86dc-5091f1324e1b"> <div class="highlight php"> <table style="border-spacing: 0"><tbody><tr> <td class="gutter gl" style="text-align: right"><pre class="lineno">1 +</pre></td> </tr></tbody></table> </div> </div> <div data-tab="PHP SDK" data-lang="php" id="tab-fa03f531-3dbc-4323-a8ff-91ed613c9e89"> <div class="highlight php"> <table style="border-spacing: 0"><tbody><tr> <td class="gutter gl" style="text-align: right"><pre class="lineno">1 2 3 4 @@ -83,7 +83,7 @@ Your system is all ready to go. <span class="nb">print_r</span><span class="p">(</span><span class="nv">$response</span><span class="p">);</span> <span class="cp">?></span> -</pre></td> </tr></tbody></table> </div> </div> <div data-tab="Ruby SDK" data-lang="ruby" id="tab-5f3cfd21-824e-4ac1-9cdb-bb7d085e5227"> <div class="highlight ruby"> <table style="border-spacing: 0"><tbody><tr> <td class="gutter gl" style="text-align: right"><pre class="lineno">1 +</pre></td> </tr></tbody></table> </div> </div> <div data-tab="Ruby SDK" data-lang="ruby" id="tab-780739ad-be6e-4e23-97a4-d3fb771b2110"> <div class="highlight ruby"> <table style="border-spacing: 0"><tbody><tr> <td class="gutter gl" style="text-align: right"><pre class="lineno">1 2 3 4 @@ -96,7 +96,7 @@ Your system is all ready to go. <span class="n">response</span> <span class="o">=</span> <span class="n">client</span><span class="p">.</span><span class="nf">send_query</span><span class="p">(</span><span class="s1">'q'</span> <span class="o">=></span> <span class="s1">'foo'</span><span class="p">)</span> <span class="nb">puts</span> <span class="n">response</span> -</pre></td> </tr></tbody></table> </div> </div> <div data-tab="Java SDK" data-lang="java" id="tab-de04d5cd-e35b-42c0-9adb-e5dbbcce9916"> <div class="highlight java"> <table style="border-spacing: 0"><tbody><tr> <td class="gutter gl" style="text-align: right"><pre class="lineno">1 +</pre></td> </tr></tbody></table> </div> </div> <div data-tab="Java SDK" data-lang="java" id="tab-f62db435-0b2f-4a0b-95ea-23e7f008d812"> <div class="highlight java"> <table style="border-spacing: 0"><tbody><tr> <td class="gutter gl" style="text-align: right"><pre class="lineno">1 2 3 4