📅  最后修改于: 2022-03-11 14:45:32.129000             🧑  作者: Mango
def get_image_download_link(img):
"""Generates a link allowing the PIL image to be downloaded
in: PIL image
out: href string
"""
buffered = BytesIO()
img.save(buffered, format="JPEG")
img_str = base64.b64encode(buffered.getvalue()).decode()
href = f'Download result'
return href
st.image(img, caption=f"Image Predicted")
result = Image.fromarray(img)
st.markdown(get_image_download_link(result), unsafe_allow_html=True)