We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
FEAT: Disable Gradio Telemetry
Pull requests are disabled but see here:

https://github.com/arch-btw/inference/pull/1

--- 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/gradio_chatinterface.py`
Content:
```
1 from typing import Dict, List
2 
3 import gradio as gr
4 
5 from xinference.client import Client
6 
7 if __name__ == "__main__":
8     import argparse
9     import textwrap
10 
11     parser = argparse.ArgumentParser(
12         formatter_class=argparse.RawDescriptionHelpFormatter,
13         epilog=textwrap.dedent(
14             """\
15              instructions to run:
16                  1. Install Xinference and Llama-cpp-python
17                  2. Run 'xinference --host "localhost" --port 9997' in terminal
18                  3. Run this python file in new terminal window
19 
20                  e.g. (feel free to copy)
21                  python gradio_chatinterface.py \\
22                  --endpoint http://localhost:9997 \\
23                  --model_name vicuna-v1.3 \\
24                  --model_size_in_billions 7 \\
25                  --model_format ggmlv3 \\
26                  --quantization q2_K
27 
28                  If you decide to change the port number in step 2,
29                  please also change the endpoint in the arguments
30              """
31         ),
32     )
33 
34     parser.add_argument(
35         "--endpoint", type=str, required=True, help="Xinference endpoint, required"
36     )
37     parser.add_argument(
38         "--model_name", type=str, required=True, help="Name of the model, required"
39     )
40     parser.add_argument(
41         "--model_size_in_billions",
42         type=int,
43         required=False,
44         help="Size of the model in billions",
45     )
46     parser.add_argument(
47         "--model_format",
48         type=str,
49         required=False,
50         help="Format of the model",
51     )
52     parser.add_argument(
53         "--quantization", type=str, required=False, help="Quantization of the model"
54     )
55 
56     args = parser.parse_args()
57 
58     endpoint = args.endpoint
59     model_name = args.model_name
60     model_size_in_billions = args.model_size_in_billions
61     model_format = args.model_format
62     quantization = args.quantization
63 
64     print(f"Xinference endpoint: {endpoint}")
65     print(f"Model Name: {model_name}")
66     print(f"Model Size (in billions): {model_size_in_billions}")
67     print(f"Model Format: {model_format}")
68     print(f"Quantization: {quantization}")
69 
70     client = Client(endpoint)
71     model_uid = client.launch_model(
72         model_name,
73         model_size_in_billions=model_size_in_billions,
74         model_format=model_format,
75         quantization=quantization,
76         n_ctx=2048,
77     )
78     model = client.get_model(model_uid)
79 
80     def flatten(matrix: List[List[str]]) -> List[str]:
81         flat_list = []
82         for row in matrix:
83             flat_list += row
84         return flat_list
85 
86     def to_chat(lst: List[str]) -> List[Dict[str, str]]:
87         res = []
88         for i in range(len(lst)):
89             role = "assistant" if i % 2 == 1 else "user"
90             res.append(
91                 {
92                     "role": role,
93                     "content": lst[i],
94                 }
95             )
96         return res
97 
98     def generate_wrapper(message: str, history: List[List[str]]) -> str:
99         output = model.chat(
100             prompt=message,
101             chat_history=to_chat(flatten(history)),
102             generate_config={"max_tokens": 512, "stream": False},
103         )
104         return output["choices"][0]["message"]["content"]
105 
106     demo = gr.ChatInterface(
107         fn=generate_wrapper,
108         examples=[
109             "Show me a two sentence horror story with a plot twist",
110             "Generate a Haiku poem using trignometry as the central theme",
111             "Write three sentences of scholarly description regarding a supernatural beast",
112             "Prove there does not exist a largest integer",
113         ],
114         title="Xinference Chat Bot",
115     )
116     demo.launch()
117
```
--- 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/examples/gradio_chatinterface.py b/examples/gradio_chatinterface.py
--- a/examples/gradio_chatinterface.py
+++ b/examples/gradio_chatinterface.py
@@ -105,6 +105,7 @@
 
     demo = gr.ChatInterface(
         fn=generate_wrapper,
+        analytics_enabled=False,
         examples=[
             "Show me a two sentence horror story with a plot twist",
             "Generate a Haiku poem using trignometry as the central theme",

{"golden_diff": "diff --git a/examples/gradio_chatinterface.py b/examples/gradio_chatinterface.py\n--- a/examples/gradio_chatinterface.py\n+++ b/examples/gradio_chatinterface.py\n@@ -105,6 +105,7 @@\n \n     demo = gr.ChatInterface(\n         fn=generate_wrapper,\n+        analytics_enabled=False,\n         examples=[\n             \"Show me a two sentence horror story with a plot twist\",\n             \"Generate a Haiku poem using trignometry as the central theme\",\n", "issue": "FEAT: Disable Gradio Telemetry\nPull requests are disabled but see here:\r\n\r\nhttps://github.com/arch-btw/inference/pull/1\n", "before_files": [{"content": "from typing import Dict, List\n\nimport gradio as gr\n\nfrom xinference.client import Client\n\nif __name__ == \"__main__\":\n    import argparse\n    import textwrap\n\n    parser = argparse.ArgumentParser(\n        formatter_class=argparse.RawDescriptionHelpFormatter,\n        epilog=textwrap.dedent(\n            \"\"\"\\\n             instructions to run:\n                 1. Install Xinference and Llama-cpp-python\n                 2. Run 'xinference --host \"localhost\" --port 9997' in terminal\n                 3. Run this python file in new terminal window\n\n                 e.g. (feel free to copy)\n                 python gradio_chatinterface.py \\\\\n                 --endpoint http://localhost:9997 \\\\\n                 --model_name vicuna-v1.3 \\\\\n                 --model_size_in_billions 7 \\\\\n                 --model_format ggmlv3 \\\\\n                 --quantization q2_K\n\n                 If you decide to change the port number in step 2,\n                 please also change the endpoint in the arguments\n             \"\"\"\n        ),\n    )\n\n    parser.add_argument(\n        \"--endpoint\", type=str, required=True, help=\"Xinference endpoint, required\"\n    )\n    parser.add_argument(\n        \"--model_name\", type=str, required=True, help=\"Name of the model, required\"\n    )\n    parser.add_argument(\n        \"--model_size_in_billions\",\n        type=int,\n        required=False,\n        help=\"Size of the model in billions\",\n    )\n    parser.add_argument(\n        \"--model_format\",\n        type=str,\n        required=False,\n        help=\"Format of the model\",\n    )\n    parser.add_argument(\n        \"--quantization\", type=str, required=False, help=\"Quantization of the model\"\n    )\n\n    args = parser.parse_args()\n\n    endpoint = args.endpoint\n    model_name = args.model_name\n    model_size_in_billions = args.model_size_in_billions\n    model_format = args.model_format\n    quantization = args.quantization\n\n    print(f\"Xinference endpoint: {endpoint}\")\n    print(f\"Model Name: {model_name}\")\n    print(f\"Model Size (in billions): {model_size_in_billions}\")\n    print(f\"Model Format: {model_format}\")\n    print(f\"Quantization: {quantization}\")\n\n    client = Client(endpoint)\n    model_uid = client.launch_model(\n        model_name,\n        model_size_in_billions=model_size_in_billions,\n        model_format=model_format,\n        quantization=quantization,\n        n_ctx=2048,\n    )\n    model = client.get_model(model_uid)\n\n    def flatten(matrix: List[List[str]]) -> List[str]:\n        flat_list = []\n        for row in matrix:\n            flat_list += row\n        return flat_list\n\n    def to_chat(lst: List[str]) -> List[Dict[str, str]]:\n        res = []\n        for i in range(len(lst)):\n            role = \"assistant\" if i % 2 == 1 else \"user\"\n            res.append(\n                {\n                    \"role\": role,\n                    \"content\": lst[i],\n                }\n            )\n        return res\n\n    def generate_wrapper(message: str, history: List[List[str]]) -> str:\n        output = model.chat(\n            prompt=message,\n            chat_history=to_chat(flatten(history)),\n            generate_config={\"max_tokens\": 512, \"stream\": False},\n        )\n        return output[\"choices\"][0][\"message\"][\"content\"]\n\n    demo = gr.ChatInterface(\n        fn=generate_wrapper,\n        examples=[\n            \"Show me a two sentence horror story with a plot twist\",\n            \"Generate a Haiku poem using trignometry as the central theme\",\n            \"Write three sentences of scholarly description regarding a supernatural beast\",\n            \"Prove there does not exist a largest integer\",\n        ],\n        title=\"Xinference Chat Bot\",\n    )\n    demo.launch()\n", "path": "examples/gradio_chatinterface.py"}], "after_files": [{"content": "from typing import Dict, List\n\nimport gradio as gr\n\nfrom xinference.client import Client\n\nif __name__ == \"__main__\":\n    import argparse\n    import textwrap\n\n    parser = argparse.ArgumentParser(\n        formatter_class=argparse.RawDescriptionHelpFormatter,\n        epilog=textwrap.dedent(\n            \"\"\"\\\n             instructions to run:\n                 1. Install Xinference and Llama-cpp-python\n                 2. Run 'xinference --host \"localhost\" --port 9997' in terminal\n                 3. Run this python file in new terminal window\n\n                 e.g. (feel free to copy)\n                 python gradio_chatinterface.py \\\\\n                 --endpoint http://localhost:9997 \\\\\n                 --model_name vicuna-v1.3 \\\\\n                 --model_size_in_billions 7 \\\\\n                 --model_format ggmlv3 \\\\\n                 --quantization q2_K\n\n                 If you decide to change the port number in step 2,\n                 please also change the endpoint in the arguments\n             \"\"\"\n        ),\n    )\n\n    parser.add_argument(\n        \"--endpoint\", type=str, required=True, help=\"Xinference endpoint, required\"\n    )\n    parser.add_argument(\n        \"--model_name\", type=str, required=True, help=\"Name of the model, required\"\n    )\n    parser.add_argument(\n        \"--model_size_in_billions\",\n        type=int,\n        required=False,\n        help=\"Size of the model in billions\",\n    )\n    parser.add_argument(\n        \"--model_format\",\n        type=str,\n        required=False,\n        help=\"Format of the model\",\n    )\n    parser.add_argument(\n        \"--quantization\", type=str, required=False, help=\"Quantization of the model\"\n    )\n\n    args = parser.parse_args()\n\n    endpoint = args.endpoint\n    model_name = args.model_name\n    model_size_in_billions = args.model_size_in_billions\n    model_format = args.model_format\n    quantization = args.quantization\n\n    print(f\"Xinference endpoint: {endpoint}\")\n    print(f\"Model Name: {model_name}\")\n    print(f\"Model Size (in billions): {model_size_in_billions}\")\n    print(f\"Model Format: {model_format}\")\n    print(f\"Quantization: {quantization}\")\n\n    client = Client(endpoint)\n    model_uid = client.launch_model(\n        model_name,\n        model_size_in_billions=model_size_in_billions,\n        model_format=model_format,\n        quantization=quantization,\n        n_ctx=2048,\n    )\n    model = client.get_model(model_uid)\n\n    def flatten(matrix: List[List[str]]) -> List[str]:\n        flat_list = []\n        for row in matrix:\n            flat_list += row\n        return flat_list\n\n    def to_chat(lst: List[str]) -> List[Dict[str, str]]:\n        res = []\n        for i in range(len(lst)):\n            role = \"assistant\" if i % 2 == 1 else \"user\"\n            res.append(\n                {\n                    \"role\": role,\n                    \"content\": lst[i],\n                }\n            )\n        return res\n\n    def generate_wrapper(message: str, history: List[List[str]]) -> str:\n        output = model.chat(\n            prompt=message,\n            chat_history=to_chat(flatten(history)),\n            generate_config={\"max_tokens\": 512, \"stream\": False},\n        )\n        return output[\"choices\"][0][\"message\"][\"content\"]\n\n    demo = gr.ChatInterface(\n        fn=generate_wrapper,\n        analytics_enabled=False,\n        examples=[\n            \"Show me a two sentence horror story with a plot twist\",\n            \"Generate a Haiku poem using trignometry as the central theme\",\n            \"Write three sentences of scholarly description regarding a supernatural beast\",\n            \"Prove there does not exist a largest integer\",\n        ],\n        title=\"Xinference Chat Bot\",\n    )\n    demo.launch()\n", "path": "examples/gradio_chatinterface.py"}]}