How to compile and call into Python script on a mobile OS?

I have a Python script running on Ubuntu 22.04.5 using several large modules:

import numpy as np, pandas as pd, cv2 as cv
from itertools import product
from skan import Skeleton, summarize
from collections import Counter

It has just one user function, which creates a short YAML or JSON string. What are the options to call this function, preferably compiled, on a mobile device running a JavaScript app on Android or iOS?