Running a fraud detection job with Lilypad
Open this contract in Remix -> Click here
This example uses the Fraud Detection Docker image found on Docker Hub HackFS.
Run the Image with Bacalhau using the command bacalhau docker --network=http --domain=api.etherscan.com run hakymulla/hackfs:inference -- python predict.py --address "0x427aE6048C7d2DEd45a07Ea46F2873d0F9ddDb35"
Run Bacalhau get [Job ID] to the format of the spec needed to call runLilypadJob
.
For more info on the dataset, how to create the Fraud Detection Script and Docker Image see My HackFS Github.
This example can be found in the Examples folder in the Lilypad-v0 Project Github.
To run this example, you can simply deploy it to any supported network and pass in the contact address to the constructor which corresponds to your network. See deployed-network-details.md
.
Open this example in remix -> click here
To Deploy on Filecoin Calibration Net, use the LilypadEvents Contract Address deployed on the testnet (0xdC7612fa94F098F1d7BB40E0f4F4db8fF0bC8820).
Call the IsFraudDetector function and add an Ethereum Address as input.
IsFraudDetector is a payable function that calls the the bridge runLilypadJob.
In this example the Lilypad FraudDetection Job Results is returned as a StdOut. You can use the allResult function to see the results.
Let's build on the above example by Creating and Interacting with Tableland table using smart contracts.
Open this example in remix -> click here
During contract deployment, a tableland table is created. The bridge while calling the lilypadFulfilled also saves the results of inference to the table which can be used to monitor the model perfomance.
Storing a reference to the table ID and prefix within your contract is advisable since it enhances ease of reference in different methods, facilitating smoother execution.
The TablelandDeployments contract helps set up the TablelandTables interface by returning ITablelandTables instantiated with the correct registry address, inferred by the chain being used. This is added to the constructor. The table columns includes an id, address and the result.
A insert function is created to write to the above table
notice the onlyBridge modifier, only the bridge can write to the table and happens during the call back.
The above insert function is called in the lilypadFulfilled function
Query the table on Click here.