# Image Inference Error

**URL:** <https://discuss.roboflow.com/t/image-inference-error/6966>\
**Category:** 🤝  Community Help\
**Tags:** bugs\
**Created:** [September 4, 2024, 9:13pm UTC](https://discuss.roboflow.com/t/image-inference-error/6966 "2024-09-04T21:13:21Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ntokozo\_Nhlangothi](https://yyz1.discourse-cdn.com/flex029/user_avatar/discuss.roboflow.com/ntokozo_nhlangothi/32/5403_2.png) [@Ntokozo\_Nhlangothi](https://discuss.roboflow.com/u/Ntokozo_Nhlangothi)\
**Post date:** [September 4, 2024, 9:13pm UTC](https://discuss.roboflow.com/t/image-inference-error/6966/1 "2024-09-04T21:13:21Z")

</div>

Im trying out an example from one of the blog posts and am getting an error. I looked through the forum, and the solution of upgrading roboflow to latest doesnt solve the issue. Whats the problem?  
from roboflow import Roboflow

import supervision as sv

import cv2

import tempfile

import os

# Load the Roboflow API and authenticate with your API key

rf = Roboflow(api\_key=“xxxxxxx”)

# Load the project for identifying parts of the car

project\_parts = rf.workspace().project(“car-parts-segmentation”)

model\_parts = project\_parts.version(2).model

# Load the project for detecting damaged areas of the car

project\_damage = rf.workspace().project(“car-damage-detection-ha5mm”)

model\_damage = project\_damage.version(1).model

# Path to the input image

img\_path = “13b15550cec5cabf63fe48bcf17aaa05.jpg”

# Run the models on the input image

result\_damage = model\_damage.predict(img\_path, confidence=40).json()

# Im getting the following error " line 22, in

```
result_damage = model_damage.predict(img_path, confidence=40).json()
                ^^^^^^^^^^^^^^^^^^^^

```

AttributeError: ‘NoneType’ object has no attribute ‘predict’"

---

<div class="post-metadata">

**Author:** ![Malte\_Robert](https://yyz1.discourse-cdn.com/flex029/user_avatar/discuss.roboflow.com/malte_robert/32/5401_2.png) [@Malte\_Robert](https://discuss.roboflow.com/u/Malte_Robert)\
**Post date:** [September 5, 2024, 6:12am UTC](https://discuss.roboflow.com/t/image-inference-error/6966/2 "2024-09-05T06:12:18Z")

</div>

I have the exact same problem but haven’t found a good solution, if you use roboflow==0.2.23 it will instead download the json\_response file with another error. However I found that by doing the image recognition online it seams to work if that is viable to you? Check out my post to see if you find anything of help and please let me know if you solve it! [Roboflow Post](https://discuss.roboflow.com/t/error-when-trying-to-use-costum-yolov8-model-on-raspberry-pi-5/6964)

Here is a way to run It online:

Install inference.

```auto
pip install inference

```

If you have an NVIDIA GPU that supports CUDA

```auto
pip install inference-gpu

```

Add your Roboflow API Key as an environment variable or in a `.env` file. Just run it in the terminal basically

```auto
export ROBOFLOW_API_KEY="YOUR_PRIVATE_API_KEY"

```

Use it in your python project.

```auto
import inference
model = inference.get_model("Project_ID/Version number") #It should be in one sentence like this (untilted-asfg/1) where untilted-asfg is the model ID and 1 is the version
results = model.infer(image="YOUR_IMAGE.jpg")
print(results)

please let me know if that works for you! If my "tutorial" is uncomprehendable you can just find it under model-> deployments -> Self Hosted Reference (native Python)

```

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex029/uploads/roboflow1/original/1X/bb6edbfa56d0cf2ee603f061e9e09103502cc8cc.png) [@system](https://discuss.roboflow.com/u/system)\
**Post date:** [September 26, 2024, 6:12am UTC](https://discuss.roboflow.com/t/image-inference-error/6966/3 "2024-09-26T06:12:51Z")

</div>

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.
