An API endpoint that wraps using the Lilypad cli. This repo consists of the JS CLI wrapper for Lilypad as well as a Python proxy used to abstract the private key using a Gradio example application.
This Gradio example can be used to proxy for building react apps and other applications to run AI inference on Lilypad.
- Docker installed and started
- Clone the JS CLI repo
git clone https://github.com/Lilypad-Tech/js-cli-wrapper
cd js-cli-wrapper
code .
- Ensure Docker is running
- Run from menu (F5)
In inputs, each input must be preceeded by the -i flag, including tunables. For example: "inputs": "-i Prompt='an astronaut floating against a white background' -i Steps=50"
The endpoint can then be tested using curl
Note: This tool is for demonstration purposes and will be improved upon in the coming weeks for greater scalability. Use the following post request with the WEB3_PRIVATE_KEY in the .env file provided. The wallet/private key below is funded with testnet tokens only and has been setup to simplify the use of this developer tool.
"data": [
"cowsay:v0.0.4,Message",
"Hello!!"
]}' \
| awk -F'"' '{ print $4}' \
| read EVENT_ID; curl -N http://localhost:7860/gradio_api/call/run/$EVENT_ID
pip install gradio_client
client = Client("http://localhost:7860/")
result = client.predict(
dropdown="cowsay:v0.0.4,Message",
prompt="Hello!!",
api_name="/run"
)
print(result)
npm i -D @gradio/client
const client = await Client.connect("http://localhost:7860/");
const result = await client.predict("/run", {
dropdown: "cowsay:v0.0.4,Message",
prompt: "Hello!!",
});
console.log(result.data);