Hi I am using python and my code was working until the last day of my free trial, and then it gave me predictions =
When I upgraded my account, the visualization tool on Roboflow.com started working again. But my API routines still yield an empty set.
And one other issue. I can recognize a 20MB jpg file on Roboflow.com visualize, but it wont recognize on the API. I am not sure what the limitations of the API are, or the best way to preprocess an image before sending it to the roboflow API.
Because it would be nice to produce a high quality image for visualization, and simply overlay the bounding boxes.
Code snippets:
#@title Connect to Roboflow
#Downloading data from Roboflow
from roboflow import Roboflow
rf = Roboflow(api_key=“API_KEY”)
project = rf.workspace(“XXX”).project(“XXXX”)
model = project.version(3).model
#dataset = project.version(3).download(“tfrecord”)
…
try:
# This is the line where the error is being thrown
predictions = model.predict(image_path, confidence=50).json()
print(predictions)
# Continue with the rest of your code that processes the predictions
# ...
except UnidentifiedImageError as e:
print(f"Error: Cannot identify image file. Please ensure the file is a valid image. {e}“)
except Exception as e:
print(f"An unexpected error occurred: {e}”)
Errors:
Enter the image file name (with extension, e.g., ‘example.jpg’): page_15L.png
{‘predictions’: , ‘image’: {‘width’: ‘2286’, ‘height’: ‘1616’}}