Py.Cafe

maartenbreddels/

solara-release-test

Solara Click Increment App

DocsPricing
  • app.py
  • requirements.txt
app.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import mesa

# You can either define the BoltzmannWealthModel (aka MoneyModel) or install mesa-models:

from mesa_models.boltzmann_wealth_model.model import BoltzmannWealthModel

def agent_portrayal(agent):
    return {
        "color": "tab:blue",
        "size": 50,
    }
model_params = {
    "N": {
        "type": "SliderInt",
        "value": 50,
        "label": "Number of agents:",
        "min": 10,
        "max": 100,
        "step": 1,
    },
    "width": 10,
    "height": 10,
}
from mesa.experimental import JupyterViz

page = JupyterViz(
    BoltzmannWealthModel,
    model_params,
    measures=["Gini"],
    name="Money Model",
    agent_portrayal=agent_portrayal,
)
# This is required to render the visualization in the Jupyter notebook
page