Skip to content

secretarium/klave-ai-inference

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Klave - Confidential AI Inference

Exemple of Confidential AI inference with LightGBM on Klave.

Wasm AssemblyScript

Description

This contract implements a single method getExposureRisk that take user input, load lightGBM model, infer from user input, unload LightGBM model and return results to the user. We use as an example the model we have created for determinating COVID contamination risk - Paper

Build your back-end locally

Fork the repo https://github.com/secretarium/klave-ai-inference and clone it on your machine. You can build your template into wasm locally, allowing you to validate the hash of the application deployed on Klave.

Note: You should have node and yarn installed to be able to build locally.

yarn install
yarn build

Deploy your own back-end

You can deploy the back-end of the secure data room to Klave with one click: Deploy on Klave

Retrieve the address of your honest application after deployment on klave website as you will target it within the UI and the storage server.

Try it !

After deploying the contract and allocating Credit the App, you can try to call the method getExposureRisk method with the following input:

{
	"riskProfile": "low",
	"questionnaire": {
		"locationType": 8,
		"locationInsideOrOutside": 0,
		"numberOfPeoplePresent": 3,
		"timeSpentOnLocation": 0,
		"wearingMask": 0,
		"staffProperlyWearingPPE": 0,
		"peopleProperlyWearingPPE": 0,
		"socialDistancing": 1,
		"additionalMeasuresInPlace" : 0,
		"numberOfPeopleInTheParty": 1,
		"allMemberOfHousehold": 1,
		"allMemberOfSupportBubble": 0,
		"qualityOfTheAirflow": 3,
		"temperatureInVenue": 2,
		"humidityInVenue": 1,
		"cleanAfterEveryUsage": 3,
		"anyContactBetweenMembers": 2,
		"physicalActivity": 2,
		"exposureLedContamination": 2
	}
}

And you should get the following output:

{
   "inferred": 0.5018788418268543,
   "riskIndex": 1,
   "contaminationStatus": "medium",
   "colour": "#fe6100",
   "visuallyImpairedColour": "#dc267f"
}

Don't hesitates to play with the input to infer different results.

Authors

This library is created by Klave and Secretarium team members, with contributions from:

About

Exemple of AI inference with LightGBM on Klave

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published