raise InvalidSchema("No connection adapters were found for {!r}".format(url)) requests.exceptions.InvalidSchema: No connection adapters were found for '/v1/models/flower-classification:predict'

Summa have this issue too. below is the code.
import os
import json
import io
import requests
import numpy as np
import tensorflow as tf
from PIL import Image
import matplotlib.pyplot as plt
import PIL

ASSETS_DIR = r"C:\Users\Sortol\Documents\adesoji-fastapi\assets"
TEST_IMAGES_DIR = r"C:\Users\Sortol\Documents\adesoji-fastapi\images"

classes = json.load(open(os.path.join(ASSETS_DIR,'categories.json')))
classes = {v:k for k,v in classes.items()}

URL = "/v1/models/flower-classification:predict"

def read_img_file(file) -> Image.Image:
img = Image.open(io.BytesIO(file))
if img.mode == "RGBA":
img = img.convert("RGB")
img = img.resize((224,224), Image.ANTIALIAS)
img = tf.expand_dims(np.asarray(img)/255, 0)
return img

def load_img(img_path, show:bool=False):

img_path = random.choice(glob.glob(f"{DATASET_DIR}/test/{cls}/*.jpg"))
img = PIL.Image.open(img_path)
img = img.resize((224,224), PIL.Image.ANTIALIAS)
if show:
plt.imshow(img)
plt.title('cls')
img = tf.expand_dims(np.asarray(img)/255, 0)
return img

def predict(img):
headers = {
"content-type" : "application/json"
}
data = json.dumps({
"signature_name": "serving_default", "instances": img.numpy().tolist()
})
response = requests.post(URL, data=data, headers=headers)
response_data = json.loads(response.text)['predictions'][0]
confidence = np.max(response_data)
predicted_class = classes[np.argmax(response_data)]
return response_data,confidence,predicted_class

now i get this error below

C:\Users\Sortol\Documents\adesoji-fastapi\app>uvicorn main:app
2021-03-01 23:18:10.330558: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library cudart64_110.dll
INFO: Started server process [6912]
INFO: Waiting for application startup.
INFO: Application startup complete.
INFO: Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit)
INFO: 127.0.0.1:54121 - "GET / HTTP/1.1" 404 Not Found
INFO: 127.0.0.1:54129 - "GET /docs HTTP/1.1" 200 OK
INFO: 127.0.0.1:54129 - "GET /openapi.json HTTP/1.1" 200 OK
2021-03-01 23:18:39.587847: I tensorflow/compiler/jit/xla_cpu_device.cc:41] Not creating XLA devices, tf_xla_enable_xla_devices not set
2021-03-01 23:18:39.596337: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library nvcuda.dll
2021-03-01 23:18:39.686352: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1720] Found device 0 with properties:
pciBusID: 0000:03:00.0 name: GeForce 840M computeCapability: 5.0
coreClock: 1.124GHz coreCount: 3 deviceMemorySize: 2.00GiB deviceMemoryBandwidth: 13.41GiB/s
2021-03-01 23:18:39.687791: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library cudart64_110.dll
2021-03-01 23:18:39.782907: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library cublas64_11.dll
2021-03-01 23:18:39.783942: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library cublasLt64_11.dll
2021-03-01 23:18:39.832809: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library cufft64_10.dll
2021-03-01 23:18:39.844951: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library curand64_10.dll
2021-03-01 23:18:39.939685: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library cusolver64_10.dll
2021-03-01 23:18:39.961540: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library cusparse64_11.dll
2021-03-01 23:18:39.965590: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library cudnn64_8.dll
2021-03-01 23:18:39.966611: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1862] Adding visible gpu devices: 0
2021-03-01 23:18:39.981739: I tensorflow/core/platform/cpu_feature_guard.cc:142] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance-critical operations: AVX2
To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.
2021-03-01 23:18:39.985255: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1720] Found device 0 with properties:
pciBusID: 0000:03:00.0 name: GeForce 840M computeCapability: 5.0
coreClock: 1.124GHz coreCount: 3 deviceMemorySize: 2.00GiB deviceMemoryBandwidth: 13.41GiB/s
2021-03-01 23:18:39.987565: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library cudart64_110.dll
2021-03-01 23:18:39.988770: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library cublas64_11.dll
2021-03-01 23:18:39.989115: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library cublasLt64_11.dll
2021-03-01 23:18:39.989445: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library cufft64_10.dll
2021-03-01 23:18:39.989775: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library curand64_10.dll
2021-03-01 23:18:39.991063: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library cusolver64_10.dll
2021-03-01 23:18:39.991441: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library cusparse64_11.dll
2021-03-01 23:18:39.991842: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library cudnn64_8.dll
2021-03-01 23:18:39.993129: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1862] Adding visible gpu devices: 0
2021-03-01 23:18:43.086253: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1261] Device interconnect StreamExecutor with strength 1 edge matrix:
2021-03-01 23:18:43.088620: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1267] 0
2021-03-01 23:18:43.089128: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1280] 0: N
2021-03-01 23:18:43.107867: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1406] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with
1369 MB memory) -> physical GPU (device: 0, name: GeForce 840M, pci bus id: 0000:03:00.0, compute capability: 5.0)
2021-03-01 23:18:43.156687: I tensorflow/compiler/jit/xla_gpu_device.cc:99] Not creating XLA devices, tf_xla_enable_xla_devices not set
tf.Tensor(
[[[[0.64705882 0.65490196 0.48627451]
[0.58823529 0.60392157 0.46666667]
[0.54117647 0.56078431 0.42352941]
...
[0.35686275 0.52941176 0.32941176]
[0.20392157 0.34509804 0.23529412]
[0.13333333 0.25882353 0.14117647]]

[[0.6627451 0.69411765 0.51372549]
[0.58431373 0.60784314 0.4627451 ]
[0.50588235 0.50980392 0.4 ]
...
[0.39607843 0.55294118 0.36470588]
[0.15294118 0.29411765 0.18431373]
[0.05098039 0.18823529 0.06666667]]

[[0.61960784 0.64313725 0.50196078]
[0.63921569 0.62745098 0.52156863]
[0.57254902 0.51764706 0.47843137]
...
[0.38039216 0.52156863 0.36862745]
[0.16862745 0.30980392 0.21568627]
[0.0745098 0.21960784 0.09411765]]

...

[[0.32941176 0.48627451 0.33333333]
[0.32941176 0.48627451 0.3254902 ]
[0.31764706 0.50196078 0.32156863]
...
[0.57254902 0.68235294 0.66666667]
[0.23529412 0.34509804 0.36078431]
[0.20784314 0.3254902 0.29411765]]

[[0.36078431 0.48235294 0.3372549 ]
[0.35686275 0.49019608 0.32941176]
[0.34117647 0.52156863 0.3372549 ]
...
[0.53333333 0.67058824 0.63137255]
[0.22745098 0.36078431 0.37254902]
[0.27843137 0.40392157 0.37647059]]

[[0.34509804 0.4745098 0.32941176]
[0.34117647 0.49019608 0.32156863]
[0.33333333 0.52156863 0.3254902 ]
...
[0.51764706 0.67843137 0.61568627]
[0.25098039 0.40392157 0.40784314]
[0.22352941 0.37647059 0.33333333]]]], shape=(1, 224, 224, 3), dtype=float64)
INFO: 127.0.0.1:54141 - "POST /predict HTTP/1.1" 500 Internal Server Error
ERROR: Exception in ASGI application
Traceback (most recent call last):
File "c:\users\sortol\anaconda3\lib\site-packages\uvicorn\protocols\http\h11_impl.py", line 396, in run_asgi
result = await app(self.scope, self.receive, self.send)
File "c:\users\sortol\anaconda3\lib\site-packages\uvicorn\middleware\proxy_headers.py", line 45, in call
return await self.app(scope, receive, send)
File "c:\users\sortol\anaconda3\lib\site-packages\fastapi\applications.py", line 199, in call
await super().call(scope, receive, send)
File "c:\users\sortol\anaconda3\lib\site-packages\starlette\applications.py", line 111, in call
await self.middleware_stack(scope, receive, send)
File "c:\users\sortol\anaconda3\lib\site-packages\starlette\middleware\errors.py", line 181, in call
raise exc from None
File "c:\users\sortol\anaconda3\lib\site-packages\starlette\middleware\errors.py", line 159, in call
await self.app(scope, receive, _send)
File "c:\users\sortol\anaconda3\lib\site-packages\starlette\exceptions.py", line 82, in call
raise exc from None
File "c:\users\sortol\anaconda3\lib\site-packages\starlette\exceptions.py", line 71, in call
await self.app(scope, receive, sender)
File "c:\users\sortol\anaconda3\lib\site-packages\starlette\routing.py", line 566, in call
await route.handle(scope, receive, send)
File "c:\users\sortol\anaconda3\lib\site-packages\starlette\routing.py", line 227, in handle
await self.app(scope, receive, send)
File "c:\users\sortol\anaconda3\lib\site-packages\starlette\routing.py", line 41, in app
response = await func(request)
File "c:\users\sortol\anaconda3\lib\site-packages\fastapi\routing.py", line 201, in app
raw_response = await run_endpoint_function(
File "c:\users\sortol\anaconda3\lib\site-packages\fastapi\routing.py", line 148, in run_endpoint_function
return await dependant.call(**values)
File ".\main.py", line 21, in predict_image
predictions = predict(flower_img)
File ".\helpers.py", line 46, in predict
response = requests.post(URL, data=data, headers=headers)
File "c:\users\sortol\anaconda3\lib\site-packages\requests\api.py", line 119, in post
return request('post', url, data=data, json=json, **kwargs)
File "c:\users\sortol\anaconda3\lib\site-packages\requests\api.py", line 61, in request
return session.request(method=method, url=url, **kwargs)
File "c:\users\sortol\anaconda3\lib\site-packages\requests\sessions.py", line 530, in request
resp = self.send(prep, **send_kwargs)
File "c:\users\sortol\anaconda3\lib\site-packages\requests\sessions.py", line 637, in send
adapter = self.get_adapter(url=request.url)
File "c:\users\sortol\anaconda3\lib\site-packages\requests\sessions.py", line 730, in get_adapter
raise InvalidSchema("No connection adapters were found for {!r}".format(url))
requests.exceptions.InvalidSchema: No connection adapters were found for '/v1/models/flower-classification:predict'ry.

## Expected Result

What you expected.

## Actual Result

What happened instead.

## Reproduction Steps

```python
import requests

```

## System Information

    $ python -m requests.help

```
<paste here>
```

This command is only available on Requests v2.16.4 and greater. Otherwise,
please provide some basic information about your system (Python version,
operating system, &c).


You're specifying the path without a scheme or host. This is not a bug and even if it were, you did not fill out the full issue template.