We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Connection Error. Is Haystack running? JSON Issue with Docker Compose On Fresh Repo and Image Pulls
### Discussed in https://github.com/deepset-ai/haystack/discussions/1617

<div type='discussions-op-text'>

<sup>Originally posted by **sieu-tran** October 19, 2021</sup>
Between October 18, 2021 and October 19, 2021, something has changed and the docker returns the error: "Connection Error. Is Haystack running?" when we start running it.</div>

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `ui/utils.py`
Content:
```
1 import os
2 
3 import logging
4 import requests
5 import streamlit as st
6 
7 API_ENDPOINT = os.getenv("API_ENDPOINT", "http://localhost:8000")
8 STATUS = "initialized"
9 DOC_REQUEST = "query"
10 DOC_FEEDBACK = "feedback"
11 DOC_UPLOAD = "file-upload"
12 
13 
14 def haystack_is_ready():
15     url = f"{API_ENDPOINT}/{STATUS}"
16     try:
17         if requests.get(url).json():
18             return True
19     except Exception as e:
20         logging.exception(e)
21     return False
22 
23 
24 @st.cache(show_spinner=False)
25 def retrieve_doc(query, filters=None, top_k_reader=5, top_k_retriever=5):
26     # Query Haystack API
27     url = f"{API_ENDPOINT}/{DOC_REQUEST}"
28     params = {"filters": filters, "ESRetriever": {"top_k": top_k_retriever}, "Reader": {"top_k": top_k_reader}}
29     req = {"query": query, "params": params}
30     response_raw = requests.post(url, json=req).json()
31 
32     # Format response
33     result = []
34     answers = response_raw["answers"]
35     for i in range(len(answers)):
36         answer = answers[i]
37         answer_text = answer["answer"]
38         if answer_text:
39             result.append(
40                 {
41                     "context": "..." + answer["context"] + "...",
42                     "answer": answer_text,
43                     "source": answer["meta"]["name"],
44                     "relevance": round(answer["score"] * 100, 2),
45                     "document_id": answer["document_id"],
46                     "offset_start_in_doc": answer["offsets_in_document"][0]["start"],
47                 }
48             )
49     return result, response_raw
50 
51 
52 def feedback_doc(question, is_correct_answer, document_id, model_id, is_correct_document, answer, offset_start_in_doc):
53     # Feedback Haystack API
54     url = f"{API_ENDPOINT}/{DOC_FEEDBACK}"
55     #TODO adjust after Label refactoring
56     req = {
57         "question": question,
58         "is_correct_answer": is_correct_answer,
59         "document_id": document_id,
60         "model_id": model_id,
61         "is_correct_document": is_correct_document,
62         "answer": answer,
63         "offset_start_in_doc": offset_start_in_doc,
64     }
65     response_raw = requests.post(url, json=req).json()
66     return response_raw
67 
68 
69 def upload_doc(file):
70     url = f"{API_ENDPOINT}/{DOC_UPLOAD}"
71     files = [("files", file)]
72     response_raw = requests.post(url, files=files).json()
73     return response_raw
74
```
--- 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/ui/utils.py b/ui/utils.py
--- a/ui/utils.py
+++ b/ui/utils.py
@@ -25,7 +25,7 @@
 def retrieve_doc(query, filters=None, top_k_reader=5, top_k_retriever=5):
     # Query Haystack API
     url = f"{API_ENDPOINT}/{DOC_REQUEST}"
-    params = {"filters": filters, "ESRetriever": {"top_k": top_k_retriever}, "Reader": {"top_k": top_k_reader}}
+    params = {"filters": filters, "Retriever": {"top_k": top_k_retriever}, "Reader": {"top_k": top_k_reader}}
     req = {"query": query, "params": params}
     response_raw = requests.post(url, json=req).json()

{"golden_diff": "diff --git a/ui/utils.py b/ui/utils.py\n--- a/ui/utils.py\n+++ b/ui/utils.py\n@@ -25,7 +25,7 @@\n def retrieve_doc(query, filters=None, top_k_reader=5, top_k_retriever=5):\n     # Query Haystack API\n     url = f\"{API_ENDPOINT}/{DOC_REQUEST}\"\n-    params = {\"filters\": filters, \"ESRetriever\": {\"top_k\": top_k_retriever}, \"Reader\": {\"top_k\": top_k_reader}}\n+    params = {\"filters\": filters, \"Retriever\": {\"top_k\": top_k_retriever}, \"Reader\": {\"top_k\": top_k_reader}}\n     req = {\"query\": query, \"params\": params}\n     response_raw = requests.post(url, json=req).json()\n", "issue": "Connection Error. Is Haystack running? JSON Issue with Docker Compose On Fresh Repo and Image Pulls\n### Discussed in https://github.com/deepset-ai/haystack/discussions/1617\r\n\r\n<div type='discussions-op-text'>\r\n\r\n<sup>Originally posted by **sieu-tran** October 19, 2021</sup>\r\nBetween October 18, 2021 and October 19, 2021, something has changed and the docker returns the error: \"Connection Error. Is Haystack running?\" when we start running it.</div>\n", "before_files": [{"content": "import os\n\nimport logging\nimport requests\nimport streamlit as st\n\nAPI_ENDPOINT = os.getenv(\"API_ENDPOINT\", \"http://localhost:8000\")\nSTATUS = \"initialized\"\nDOC_REQUEST = \"query\"\nDOC_FEEDBACK = \"feedback\"\nDOC_UPLOAD = \"file-upload\"\n\n\ndef haystack_is_ready():\n    url = f\"{API_ENDPOINT}/{STATUS}\"\n    try:\n        if requests.get(url).json():\n            return True\n    except Exception as e:\n        logging.exception(e)\n    return False\n\n\n@st.cache(show_spinner=False)\ndef retrieve_doc(query, filters=None, top_k_reader=5, top_k_retriever=5):\n    # Query Haystack API\n    url = f\"{API_ENDPOINT}/{DOC_REQUEST}\"\n    params = {\"filters\": filters, \"ESRetriever\": {\"top_k\": top_k_retriever}, \"Reader\": {\"top_k\": top_k_reader}}\n    req = {\"query\": query, \"params\": params}\n    response_raw = requests.post(url, json=req).json()\n\n    # Format response\n    result = []\n    answers = response_raw[\"answers\"]\n    for i in range(len(answers)):\n        answer = answers[i]\n        answer_text = answer[\"answer\"]\n        if answer_text:\n            result.append(\n                {\n                    \"context\": \"...\" + answer[\"context\"] + \"...\",\n                    \"answer\": answer_text,\n                    \"source\": answer[\"meta\"][\"name\"],\n                    \"relevance\": round(answer[\"score\"] * 100, 2),\n                    \"document_id\": answer[\"document_id\"],\n                    \"offset_start_in_doc\": answer[\"offsets_in_document\"][0][\"start\"],\n                }\n            )\n    return result, response_raw\n\n\ndef feedback_doc(question, is_correct_answer, document_id, model_id, is_correct_document, answer, offset_start_in_doc):\n    # Feedback Haystack API\n    url = f\"{API_ENDPOINT}/{DOC_FEEDBACK}\"\n    #TODO adjust after Label refactoring\n    req = {\n        \"question\": question,\n        \"is_correct_answer\": is_correct_answer,\n        \"document_id\": document_id,\n        \"model_id\": model_id,\n        \"is_correct_document\": is_correct_document,\n        \"answer\": answer,\n        \"offset_start_in_doc\": offset_start_in_doc,\n    }\n    response_raw = requests.post(url, json=req).json()\n    return response_raw\n\n\ndef upload_doc(file):\n    url = f\"{API_ENDPOINT}/{DOC_UPLOAD}\"\n    files = [(\"files\", file)]\n    response_raw = requests.post(url, files=files).json()\n    return response_raw\n", "path": "ui/utils.py"}], "after_files": [{"content": "import os\n\nimport logging\nimport requests\nimport streamlit as st\n\nAPI_ENDPOINT = os.getenv(\"API_ENDPOINT\", \"http://localhost:8000\")\nSTATUS = \"initialized\"\nDOC_REQUEST = \"query\"\nDOC_FEEDBACK = \"feedback\"\nDOC_UPLOAD = \"file-upload\"\n\n\ndef haystack_is_ready():\n    url = f\"{API_ENDPOINT}/{STATUS}\"\n    try:\n        if requests.get(url).json():\n            return True\n    except Exception as e:\n        logging.exception(e)\n    return False\n\n\n@st.cache(show_spinner=False)\ndef retrieve_doc(query, filters=None, top_k_reader=5, top_k_retriever=5):\n    # Query Haystack API\n    url = f\"{API_ENDPOINT}/{DOC_REQUEST}\"\n    params = {\"filters\": filters, \"Retriever\": {\"top_k\": top_k_retriever}, \"Reader\": {\"top_k\": top_k_reader}}\n    req = {\"query\": query, \"params\": params}\n    response_raw = requests.post(url, json=req).json()\n\n    # Format response\n    result = []\n    answers = response_raw[\"answers\"]\n    for i in range(len(answers)):\n        answer = answers[i]\n        answer_text = answer[\"answer\"]\n        if answer_text:\n            result.append(\n                {\n                    \"context\": \"...\" + answer[\"context\"] + \"...\",\n                    \"answer\": answer_text,\n                    \"source\": answer[\"meta\"][\"name\"],\n                    \"relevance\": round(answer[\"score\"] * 100, 2),\n                    \"document_id\": answer[\"document_id\"],\n                    \"offset_start_in_doc\": answer[\"offsets_in_document\"][0][\"start\"],\n                }\n            )\n    return result, response_raw\n\n\ndef feedback_doc(question, is_correct_answer, document_id, model_id, is_correct_document, answer, offset_start_in_doc):\n    # Feedback Haystack API\n    url = f\"{API_ENDPOINT}/{DOC_FEEDBACK}\"\n    #TODO adjust after Label refactoring\n    req = {\n        \"question\": question,\n        \"is_correct_answer\": is_correct_answer,\n        \"document_id\": document_id,\n        \"model_id\": model_id,\n        \"is_correct_document\": is_correct_document,\n        \"answer\": answer,\n        \"offset_start_in_doc\": offset_start_in_doc,\n    }\n    response_raw = requests.post(url, json=req).json()\n    return response_raw\n\n\ndef upload_doc(file):\n    url = f\"{API_ENDPOINT}/{DOC_UPLOAD}\"\n    files = [(\"files\", file)]\n    response_raw = requests.post(url, files=files).json()\n    return response_raw\n", "path": "ui/utils.py"}]}