To define a prediction function, wrap a Python function with the @compile decorator, providing a
predictor tag and short description:
greeting.py
Copy
from muna import compile@compile( tag="@your-username/greeting", # replace `your-username` with your Muna username description="Say a friendly greeting.")def greeting(name: str) -> str: return f"Hey there {name}! We're glad you're using Muna and we hope you like it."
The predictor description is required and must be 100 characters or less.
The prediction function must specify parameter and return type annotations. Learn more.
Depending on the complexity of your function, it can take anywhere from a few seconds to a
few minutes for the function to be compiled for all platforms. Once the function is compiled, you can
run it everywhere:
Copy
import { Muna } from "muna"// 💥 Create your Muna clientconst muna = new Muna({ accessKey: "..." });// 🔥 Make a predictionconst prediction = await muna.predictions.create({ tag: "@your-username/greeting", inputs: { name: "Lina" }});// 🚀 Print the resultconsole.log(prediction.results[0]);
You can check the compilation status of the predictor at muna.ai/predictors.
Muna currently takes longer to compile functions for macOS, iOS, and visionOS due to
limited Mac compilation server capacity. We are working to provision more servers.