We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
[BUG] Sorting by similarity does not work on develop
On `develop`, nothing happens when clicking `Apply` below to sort by similarity in the App:

```py
import fiftyone as fo
import fiftyone.brain as fob
import fiftyone.zoo as foz

dataset = foz.load_zoo_dataset("quickstart")

model = foz.load_zoo_model("clip-vit-base32-torch")
fob.compute_similarity(dataset, model=model, brain_key="clip")

session = fo.launch_app(dataset)
```

<img width="628" alt="Screen Shot 2023-01-30 at 11 32 57 AM" src="https://user-images.githubusercontent.com/25985824/215537611-86a2385a-9279-410d-ac36-4ec5c7537551.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: `fiftyone/server/routes/sort.py`
Content:
```
1 """
2 FiftyOne Server /sort route
3 
4 | Copyright 2017-2023, Voxel51, Inc.
5 | `voxel51.com <https://voxel51.com/>`_
6 |
7 """
8 from starlette.endpoints import HTTPEndpoint
9 from starlette.requests import Request
10 
11 import fiftyone.core.dataset as fod
12 import fiftyone.core.fields as fof
13 import fiftyone.core.view as fov
14 
15 from fiftyone.server.decorators import route
16 import fiftyone.server.events as fose
17 from fiftyone.server.query import serialize_dataset
18 import fiftyone.server.view as fosv
19 
20 
21 class Sort(HTTPEndpoint):
22     @route
23     async def post(self, request: Request, data: dict):
24         dataset_name = data.get("dataset", None)
25         filters = data.get("filters", {})
26         stages = data.get("view", None)
27         extended = data.get("extended", None)
28         dist_field = data.get("dist_field", None)
29 
30         dataset = fod.load_dataset(dataset_name)
31 
32         changed = False
33         if dist_field and not dataset.get_field(dist_field):
34             dataset.add_sample_field(dist_field, fof.FloatField)
35             changed = True
36 
37         fosv.get_view(dataset_name, stages=stages, filters=filters)
38 
39         state = fose.get_state().copy()
40         view = fosv.get_view(dataset_name, stages=stages, filters=filters)
41         state.dataset = view._dataset
42 
43         if isinstance(view, fov.DatasetView):
44             state.view = view
45         else:
46             view = None
47 
48         return {
49             "dataset": await serialize_dataset(
50                 dataset_name=dataset_name,
51                 serialized_view=stages,
52                 view_name=view.name,
53             )
54             if changed
55             else None,
56             "state": state.serialize(),
57         }
58
```
--- 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()

```

diff --git a/fiftyone/server/routes/sort.py b/fiftyone/server/routes/sort.py
--- a/fiftyone/server/routes/sort.py
+++ b/fiftyone/server/routes/sort.py
@@ -24,9 +24,7 @@
         dataset_name = data.get("dataset", None)
         filters = data.get("filters", {})
         stages = data.get("view", None)
-        extended = data.get("extended", None)
         dist_field = data.get("dist_field", None)
-
         dataset = fod.load_dataset(dataset_name)
 
         changed = False

{"golden_diff": "diff --git a/fiftyone/server/routes/sort.py b/fiftyone/server/routes/sort.py\n--- a/fiftyone/server/routes/sort.py\n+++ b/fiftyone/server/routes/sort.py\n@@ -24,9 +24,7 @@\n         dataset_name = data.get(\"dataset\", None)\n         filters = data.get(\"filters\", {})\n         stages = data.get(\"view\", None)\n-        extended = data.get(\"extended\", None)\n         dist_field = data.get(\"dist_field\", None)\n-\n         dataset = fod.load_dataset(dataset_name)\n \n         changed = False\n", "issue": "[BUG] Sorting by similarity does not work on develop\nOn `develop`, nothing happens when clicking `Apply` below to sort by similarity in the App:\r\n\r\n```py\r\nimport fiftyone as fo\r\nimport fiftyone.brain as fob\r\nimport fiftyone.zoo as foz\r\n\r\ndataset = foz.load_zoo_dataset(\"quickstart\")\r\n\r\nmodel = foz.load_zoo_model(\"clip-vit-base32-torch\")\r\nfob.compute_similarity(dataset, model=model, brain_key=\"clip\")\r\n\r\nsession = fo.launch_app(dataset)\r\n```\r\n\r\n<img width=\"628\" alt=\"Screen Shot 2023-01-30 at 11 32 57 AM\" src=\"https://user-images.githubusercontent.com/25985824/215537611-86a2385a-9279-410d-ac36-4ec5c7537551.png\">\r\n\n", "before_files": [{"content": "\"\"\"\nFiftyOne Server /sort route\n\n| Copyright 2017-2023, Voxel51, Inc.\n| `voxel51.com <https://voxel51.com/>`_\n|\n\"\"\"\nfrom starlette.endpoints import HTTPEndpoint\nfrom starlette.requests import Request\n\nimport fiftyone.core.dataset as fod\nimport fiftyone.core.fields as fof\nimport fiftyone.core.view as fov\n\nfrom fiftyone.server.decorators import route\nimport fiftyone.server.events as fose\nfrom fiftyone.server.query import serialize_dataset\nimport fiftyone.server.view as fosv\n\n\nclass Sort(HTTPEndpoint):\n    @route\n    async def post(self, request: Request, data: dict):\n        dataset_name = data.get(\"dataset\", None)\n        filters = data.get(\"filters\", {})\n        stages = data.get(\"view\", None)\n        extended = data.get(\"extended\", None)\n        dist_field = data.get(\"dist_field\", None)\n\n        dataset = fod.load_dataset(dataset_name)\n\n        changed = False\n        if dist_field and not dataset.get_field(dist_field):\n            dataset.add_sample_field(dist_field, fof.FloatField)\n            changed = True\n\n        fosv.get_view(dataset_name, stages=stages, filters=filters)\n\n        state = fose.get_state().copy()\n        view = fosv.get_view(dataset_name, stages=stages, filters=filters)\n        state.dataset = view._dataset\n\n        if isinstance(view, fov.DatasetView):\n            state.view = view\n        else:\n            view = None\n\n        return {\n            \"dataset\": await serialize_dataset(\n                dataset_name=dataset_name,\n                serialized_view=stages,\n                view_name=view.name,\n            )\n            if changed\n            else None,\n            \"state\": state.serialize(),\n        }\n", "path": "fiftyone/server/routes/sort.py"}], "after_files": [{"content": "\"\"\"\nFiftyOne Server /sort route\n\n| Copyright 2017-2023, Voxel51, Inc.\n| `voxel51.com <https://voxel51.com/>`_\n|\n\"\"\"\nfrom starlette.endpoints import HTTPEndpoint\nfrom starlette.requests import Request\n\nimport fiftyone.core.dataset as fod\nimport fiftyone.core.fields as fof\nimport fiftyone.core.view as fov\n\nfrom fiftyone.server.decorators import route\nimport fiftyone.server.events as fose\nfrom fiftyone.server.query import serialize_dataset\nimport fiftyone.server.view as fosv\n\n\nclass Sort(HTTPEndpoint):\n    @route\n    async def post(self, request: Request, data: dict):\n        dataset_name = data.get(\"dataset\", None)\n        filters = data.get(\"filters\", {})\n        stages = data.get(\"view\", None)\n        dist_field = data.get(\"dist_field\", None)\n        dataset = fod.load_dataset(dataset_name)\n\n        changed = False\n        if dist_field and not dataset.get_field(dist_field):\n            dataset.add_sample_field(dist_field, fof.FloatField)\n            changed = True\n\n        fosv.get_view(dataset_name, stages=stages, filters=filters)\n\n        state = fose.get_state().copy()\n        view = fosv.get_view(dataset_name, stages=stages, filters=filters)\n        state.dataset = view._dataset\n\n        if isinstance(view, fov.DatasetView):\n            state.view = view\n        else:\n            view = None\n\n        return {\n            \"dataset\": await serialize_dataset(\n                dataset_name=dataset_name,\n                serialized_view=stages,\n                view_name=view.name,\n            )\n            if changed\n            else None,\n            \"state\": state.serialize(),\n        }\n", "path": "fiftyone/server/routes/sort.py"}]}