Live Demo : click me!
- You must have your API key. Don't have one? Try playing with our demo apps on estimatorlab.com to earn one.
- Python3 installed. You can install it from https://www.python.org/downloads/
clone the repository
$ git clone https://github.com/throughputer/estimator_tutorials.git
change directory
$ cd rock-paper-scissor
open the file js/rps.js
using any editor
$ vim js/rps.js
go the line number 75
To utilize your access to a ThroughPuter Estimator microservice, provide your API key here, HOWEVER...
IMPORTANT!!! It is your responsibility to keep your API key secret. This code is visible in a user's web browser,
and this demo is not intended to be hosted publicly with your private key.
this.prediction = new Prediction(
4,
true,
`wss://passgraf.com:2083/ws/<Insert-your-API-key>`,
predictionCB,
wsReady
);
Replace <Insert-your-API-key>
with your API key.
You can find your API key at estimatorlab.com/estimator
Note: Always keep your API key secret. This demo app is NOT built to be hosted publicly. Generally, unlike this demo, only the back end of your web application should connect to your private Estimator microservice.
Start a python3 http server (or any http server). You can install Python3 from here
python3 -m http.server
You should see the following, showing that your http server is running on Port 8000:
Serving HTTP on 0.0.0.0 port 8000 (http://0.0.0.0:8000/) ...
Open your favorite browser and enter the URL:
http://localhost:8000/
You can see a RPS app running with your API key. Check your Dashboard to view the number of calls made to the estimator microservice & keep track of your free credits consumption.
Note: The first 3 clicks are used to train the online Machine Learning engine and not counted towards your usage.
Questions? We can be reached at [email protected]