prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  Color patches takes a long time to load
  When you hit "reset" to load the color patches example, it takes a long time to load.
  Not sure why. As a result, I thought it was broken.
  
  To recreate... 
  ```
  cd examples/color_patches
  python run.py
  ```
  
  Wait for patches to load when browser window pops up. 
  OR hit reset and wait for color patches to load.
  
  This is what it should look something like...
  <img width="407" alt="screen shot 2018-04-01 at 10 03 33 pm" src="https://user-images.githubusercontent.com/166734/38180194-95c2acb0-35f8-11e8-8c1b-8bd7a6d25098.png">
  Color patches takes a long time to load
  When you hit "reset" to load the color patches example, it takes a long time to load.
  Not sure why. As a result, I thought it was broken.
  
  To recreate... 
  ```
  cd examples/color_patches
  python run.py
  ```
  
  Wait for patches to load when browser window pops up. 
  OR hit reset and wait for color patches to load.
  
  This is what it should look something like...
  <img width="407" alt="screen shot 2018-04-01 at 10 03 33 pm" src="https://user-images.githubusercontent.com/166734/38180194-95c2acb0-35f8-11e8-8c1b-8bd7a6d25098.png">
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `examples/color_patches/color_patches/server.py`
  Content:
  ```
  1 """
  2 handles the definition of the canvas parameters and
  3 the drawing of the model representation on the canvas
  4 """
  5 # import webbrowser
  6 
  7 from mesa.visualization.modules import CanvasGrid
  8 from mesa.visualization.ModularVisualization import ModularServer
  9 
  10 from .model import ColorPatches
  11 
  12 _COLORS = [
  13     "Aqua",
  14     "Blue",
  15     "Fuchsia",
  16     "Gray",
  17     "Green",
  18     "Lime",
  19     "Maroon",
  20     "Navy",
  21     "Olive",
  22     "Orange",
  23     "Purple",
  24     "Red",
  25     "Silver",
  26     "Teal",
  27     "White",
  28     "Yellow",
  29 ]
  30 
  31 
  32 grid_rows = 50
  33 grid_cols = 25
  34 cell_size = 10
  35 canvas_width = grid_rows * cell_size
  36 canvas_height = grid_cols * cell_size
  37 
  38 
  39 def color_patch_draw(cell):
  40     """
  41     This function is registered with the visualization server to be called
  42     each tick to indicate how to draw the cell in its current state.
  43 
  44     :param cell:  the cell in the simulation
  45 
  46     :return: the portrayal dictionary.
  47 
  48     """
  49     assert cell is not None
  50     portrayal = {"Shape": "rect", "w": 1, "h": 1, "Filled": "true", "Layer": 0}
  51     portrayal["x"] = cell.get_row()
  52     portrayal["y"] = cell.get_col()
  53     portrayal["Color"] = _COLORS[cell.get_state()]
  54     return portrayal
  55 
  56 
  57 canvas_element = CanvasGrid(
  58     color_patch_draw, grid_rows, grid_cols, canvas_width, canvas_height
  59 )
  60 
  61 server = ModularServer(
  62     ColorPatches,
  63     [canvas_element],
  64     "Color Patches",
  65     {"width": canvas_width, "height": canvas_height},
  66 )
  67 
  68 # webbrowser.open('http://127.0.0.1:8521')  # TODO: make this configurable
  69
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/examples/color_patches/color_patches/server.py b/examples/color_patches/color_patches/server.py
  --- a/examples/color_patches/color_patches/server.py
  +++ b/examples/color_patches/color_patches/server.py
  @@ -62,7 +62,7 @@
       ColorPatches,
       [canvas_element],
       "Color Patches",
  -    {"width": canvas_width, "height": canvas_height},
  +    {"width": grid_rows, "height": grid_cols},
   )
   
   # webbrowser.open('http://127.0.0.1:8521')  # TODO: make this configurable
  
verification_info: {"golden_diff": "diff --git a/examples/color_patches/color_patches/server.py b/examples/color_patches/color_patches/server.py\n--- a/examples/color_patches/color_patches/server.py\n+++ b/examples/color_patches/color_patches/server.py\n@@ -62,7 +62,7 @@\n     ColorPatches,\n     [canvas_element],\n     \"Color Patches\",\n-    {\"width\": canvas_width, \"height\": canvas_height},\n+    {\"width\": grid_rows, \"height\": grid_cols},\n )\n \n # webbrowser.open('http://127.0.0.1:8521')  # TODO: make this configurable\n", "issue": "Color patches takes a long time to load\nWhen you hit \"reset\" to load the color patches example, it takes a long time to load.\r\nNot sure why. As a result, I thought it was broken.\r\n\r\nTo recreate... \r\n```\r\ncd examples/color_patches\r\npython run.py\r\n```\r\n\r\nWait for patches to load when browser window pops up. \r\nOR hit reset and wait for color patches to load.\r\n\r\nThis is what it should look something like...\r\n<img width=\"407\" alt=\"screen shot 2018-04-01 at 10 03 33 pm\" src=\"https://user-images.githubusercontent.com/166734/38180194-95c2acb0-35f8-11e8-8c1b-8bd7a6d25098.png\">\nColor patches takes a long time to load\nWhen you hit \"reset\" to load the color patches example, it takes a long time to load.\r\nNot sure why. As a result, I thought it was broken.\r\n\r\nTo recreate... \r\n```\r\ncd examples/color_patches\r\npython run.py\r\n```\r\n\r\nWait for patches to load when browser window pops up. \r\nOR hit reset and wait for color patches to load.\r\n\r\nThis is what it should look something like...\r\n<img width=\"407\" alt=\"screen shot 2018-04-01 at 10 03 33 pm\" src=\"https://user-images.githubusercontent.com/166734/38180194-95c2acb0-35f8-11e8-8c1b-8bd7a6d25098.png\">\n", "before_files": [{"content": "\"\"\"\nhandles the definition of the canvas parameters and\nthe drawing of the model representation on the canvas\n\"\"\"\n# import webbrowser\n\nfrom mesa.visualization.modules import CanvasGrid\nfrom mesa.visualization.ModularVisualization import ModularServer\n\nfrom .model import ColorPatches\n\n_COLORS = [\n    \"Aqua\",\n    \"Blue\",\n    \"Fuchsia\",\n    \"Gray\",\n    \"Green\",\n    \"Lime\",\n    \"Maroon\",\n    \"Navy\",\n    \"Olive\",\n    \"Orange\",\n    \"Purple\",\n    \"Red\",\n    \"Silver\",\n    \"Teal\",\n    \"White\",\n    \"Yellow\",\n]\n\n\ngrid_rows = 50\ngrid_cols = 25\ncell_size = 10\ncanvas_width = grid_rows * cell_size\ncanvas_height = grid_cols * cell_size\n\n\ndef color_patch_draw(cell):\n    \"\"\"\n    This function is registered with the visualization server to be called\n    each tick to indicate how to draw the cell in its current state.\n\n    :param cell:  the cell in the simulation\n\n    :return: the portrayal dictionary.\n\n    \"\"\"\n    assert cell is not None\n    portrayal = {\"Shape\": \"rect\", \"w\": 1, \"h\": 1, \"Filled\": \"true\", \"Layer\": 0}\n    portrayal[\"x\"] = cell.get_row()\n    portrayal[\"y\"] = cell.get_col()\n    portrayal[\"Color\"] = _COLORS[cell.get_state()]\n    return portrayal\n\n\ncanvas_element = CanvasGrid(\n    color_patch_draw, grid_rows, grid_cols, canvas_width, canvas_height\n)\n\nserver = ModularServer(\n    ColorPatches,\n    [canvas_element],\n    \"Color Patches\",\n    {\"width\": canvas_width, \"height\": canvas_height},\n)\n\n# webbrowser.open('http://127.0.0.1:8521')  # TODO: make this configurable\n", "path": "examples/color_patches/color_patches/server.py"}], "after_files": [{"content": "\"\"\"\nhandles the definition of the canvas parameters and\nthe drawing of the model representation on the canvas\n\"\"\"\n# import webbrowser\n\nfrom mesa.visualization.modules import CanvasGrid\nfrom mesa.visualization.ModularVisualization import ModularServer\n\nfrom .model import ColorPatches\n\n_COLORS = [\n    \"Aqua\",\n    \"Blue\",\n    \"Fuchsia\",\n    \"Gray\",\n    \"Green\",\n    \"Lime\",\n    \"Maroon\",\n    \"Navy\",\n    \"Olive\",\n    \"Orange\",\n    \"Purple\",\n    \"Red\",\n    \"Silver\",\n    \"Teal\",\n    \"White\",\n    \"Yellow\",\n]\n\n\ngrid_rows = 50\ngrid_cols = 25\ncell_size = 10\ncanvas_width = grid_rows * cell_size\ncanvas_height = grid_cols * cell_size\n\n\ndef color_patch_draw(cell):\n    \"\"\"\n    This function is registered with the visualization server to be called\n    each tick to indicate how to draw the cell in its current state.\n\n    :param cell:  the cell in the simulation\n\n    :return: the portrayal dictionary.\n\n    \"\"\"\n    assert cell is not None\n    portrayal = {\"Shape\": \"rect\", \"w\": 1, \"h\": 1, \"Filled\": \"true\", \"Layer\": 0}\n    portrayal[\"x\"] = cell.get_row()\n    portrayal[\"y\"] = cell.get_col()\n    portrayal[\"Color\"] = _COLORS[cell.get_state()]\n    return portrayal\n\n\ncanvas_element = CanvasGrid(\n    color_patch_draw, grid_rows, grid_cols, canvas_width, canvas_height\n)\n\nserver = ModularServer(\n    ColorPatches,\n    [canvas_element],\n    \"Color Patches\",\n    {\"width\": grid_rows, \"height\": grid_cols},\n)\n\n# webbrowser.open('http://127.0.0.1:8521')  # TODO: make this configurable\n", "path": "examples/color_patches/color_patches/server.py"}]}