After adding the confidence parameter (which I can see on the browser) I get following error:
INFO: 127.0.0.1:60519 - "POST /predict?model=yolov3-tiny&confidence=0.5 HTTP/1.1" 500 Internal Server Error
Any help with that?
thanks
curl -X 'POST' \
'http://localhost:8000/predict?model=yolov3-tiny&confidence=0.5' \
-H 'accept: application/json' \
-H 'Content-Type: multipart/form-data' \
-F 'file=@apple-1868383_1280.jpg;type=image/jpeg'
http://localhost:8000/predict?model=yolov3-tiny&confidence=0.5
Internal Server Error
content-length: 21
content-type: text/plain; charset=utf-8
date: Tue,08 Jun 2021 15:29:57 GMT
server: uvicorn
Hi @dburnier
welcome to our community
The POST request seems to be correct.
It sounds as if the server was not working properly
In my case I see
INFO: Started server process [30]
INFO: Waiting for application startup.
INFO: Application startup complete.
INFO: Uvicorn running on http://0.0.0.0:8000 (Press CTRL+C to quit)
INFO: 172.17.0.1:33800 - “GET /docs HTTP/1.1” 200 OK
INFO: 172.17.0.1:33800 - “GET /openapi.json HTTP/1.1” 200 OK
INFO: 172.17.0.1:33830 - “POST /predict?model=yolov3-tiny&confidence=0.6 HTTP/1.1” 200 OK
Can you check that the server.ipynb is running properly ?
Which Method are you using? Conda or Docker?
Regards
Hi fabioantonini,
I’m using the Conda method. It was working completely fine before I added the confidence parameter.
Hi @dburnier
Thanks for the feedback.
Let’s assume that the client side is ok. I’m pretty sure that the problem is caused by anything on the server.
Can you rollback the changes on the server side? Just to understand where the problem occur.
Or can you share with me more details about the ‘confidence’ handling added to the server.ipynb?
Regards
Hi fabioantonini,
Yes, the client is not the problem.
(rolling back changes in the server solves the problem)
Here are the only 2 changes I’ve introduced to the original code:
Change 1:
OLD:
def prediction(model: Model, file: UploadFile = File(...)):
NEW:
def prediction(model: Model, confidence=0.5, file: UploadFile = File(...)):
Change 2:
OLD:
bbox, label, conf = cv.detect_common_objects(image, model=model)
NEW:
bbox, label, conf = cv.detect_common_objects(image, confidence=confidence, model=model)
Did I miss anything?
Thank you!
1 Like
Hi
I found a minor error in the syntax
Change 1:
New:
def prediction(model: Model, confidence=0.5, file: UploadFile = File(...)):
def prediction(model: Model, confidence: float, file: UploadFile = File(...)):
Please double check now and let me know
1 Like
Hi fabioantonini,
Oh, I thought I could initialize the parameter already in the calling of the function.
Thank you! Now it is working 
Great!
So if you want you can set the ‘solution’ flag to remark that the problem has been properly addressed. Thanks
2 Likes