Skip to content

Commit

Permalink
example: modal labs (#2158)
Browse files Browse the repository at this point in the history
* example: modal labs

* fix
  • Loading branch information
mscolnick authored Aug 30, 2024
1 parent abebe9e commit d033972
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 0 deletions.
27 changes: 27 additions & 0 deletions examples/modal/modal_example.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
from __future__ import annotations

import modal
from modal import asgi_app

import marimo

server = marimo.create_asgi_app().with_app(path="", root="/marimo/home.py")

app = modal.App()


@app.function(
image=modal.Image.debian_slim().pip_install("marimo>=0.8.3", "fastapi"),
gpu=False,
concurrency_limit=1,
allow_concurrent_inputs=2,
memory=256,
mounts=[modal.Mount.from_local_dir("./nbs", remote_path="/marimo")],
)
@asgi_app()
def marimo_asgi():
return server.build()


if __name__ == "__main__":
modal.serve(app)
20 changes: 20 additions & 0 deletions examples/modal/nbs/home.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import marimo

__generated_with = "0.8.4"
app = marimo.App()


@app.cell
def __(mo):
mo.md("""# Hello, from inside Modal!""")
return


@app.cell
def __():
import marimo as mo
return mo,


if __name__ == "__main__":
app.run()

0 comments on commit d033972

Please sign in to comment.