Skip to content

Bringing your code and data

Local python modules

from mymodule import myfunction
class MyApp(fal.App):
local_python_modules = ["mymodule"]
@fal.endpoint("/")
def predict(self, input: MyInput) -> MyOutput:
myfunction(input)
...

Git Repositories

from fal.toolkit import clone_repository
class MyApp(fal.App):
def setup(self):
path = clone_repository(
"https://github.com/myorg/myrepo",
commit_hash="1418c53bcfaf4efc1034207dcb39d093d5fff645",
# Add repository path to PYTHONPATH to allow importing modules
include_to_path=True,
)
import myproject
...

Data and Model weights

See Accessing Persistent Storage for more information.

from fal.toolkit import download_file
class MyApp(fal.App):
def setup(self):
path = download_file(
"https://example.com/myfile.txt",
"myfile.txt",
)
...