benitomartin / foodscore-app

FoodScore Streamlit App

Home Page:https://foodscore.streamlit.app/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

'Show nutrients' button not working

Geeky-Sam01 opened this issue · comments

Hey , I uploaded an image. It shows me this :
image
There may be some issue with the post request in file app.py at line 124.

                    dict_food = requests.post(url, files={"img": buffer.getvalue()}).json()

I think the response returns an error message or HTML,
for example - {400:"bad request"}
or it might not be valid JSON, leading to a JSONDecodeError. You can handle error responses or check if the response is json or not.

Hi Sam

This app was developed around 1 year ago. So it might be possible that the nutrition data fetched from this website https://fdc.nal.usda.gov/index.html has changed the format, or the way it shall be fetch.

So these are the steps to check:

These are the steps to follow. Unfortunatelly I am not maintaining this app as it was developed as part of a course and it is only for showcasing and educational purposes.

If you have further questions let me know!