Image does not display correctly

Hey guys! I am having trouble displaying an image using Plotly express.

def parse_contents(contents):
img = base64.b64encode(open(contents, ‘rb’).read())
fig_temp = io.imread(img)
figure = px.imshow(fig_temp, animation_frame=0, binary_string=True, labels=dict(animation_frame=“slice”))
return figure

I have this function above which takes the contents from a dcc.upload button. Unfortunately I’m having an issue with the image not displaying correctly. The error is that the file name is too long but I am unsure how to go about solving the issue. Below is a screenshot of what the error is.