Skip to content

Commit 669a746

Browse files
Merge pull request #59 from koaning/marimo-example
Base marimo example
2 parents 60bd430 + 52bdfa8 commit 669a746

1 file changed

Lines changed: 46 additions & 0 deletions

File tree

examples/marimo/main.py

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# /// script
2+
# requires-python = ">=3.12"
3+
# dependencies = [
4+
# "marimo",
5+
# "uvicorn==0.35.0",
6+
# ]
7+
# ///
8+
9+
import marimo
10+
11+
__generated_with = "0.14.13"
12+
app = marimo.App(width="columns")
13+
14+
15+
@app.cell
16+
def _():
17+
import marimo as mo
18+
import uvicorn
19+
return mo, uvicorn
20+
21+
22+
@app.cell
23+
def _(mo):
24+
slider = mo.ui.slider(1, 10, 1)
25+
slider
26+
return (slider,)
27+
28+
29+
@app.cell
30+
def _(slider):
31+
"n" + "n".join(["a"] * slider.value) + " BATMAN!"
32+
return
33+
34+
35+
@app.cell
36+
def _(mo, uvicorn):
37+
if mo.app_meta().mode == "script":
38+
import marimo
39+
40+
server = marimo.create_asgi_app().with_app(path="", root=__file__).build()
41+
uvicorn.run(server, host="0.0.0.0", port=5001)
42+
return
43+
44+
45+
if __name__ == "__main__":
46+
app.run()

0 commit comments

Comments
 (0)