Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

download button image streamlit

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'<a href="data:file/jpg;base64,{img_str}" download ="result.jpg">Download result</a>'
	return href
  st.image(img, caption=f"Image Predicted")
  result = Image.fromarray(img)
  st.markdown(get_image_download_link(result), unsafe_allow_html=True)
Comment

PREVIOUS NEXT
Code Example
Python :: full form of api 
Python :: add header info in django response 
Python :: time conversion 
Python :: python how to restart thread 
Python :: sqlalchemy function for default value for column 
Python :: what is a python module 
Python :: longest palindromic substring using dp 
Python :: child class in python 
Python :: python remove character from string 
Python :: Dynamic Form Fields Django 
Python :: oop in python 
Python :: replace nan from another column 
Python :: python turtle tutorial 
Python :: python ravel function 
Python :: python environment variable 
Python :: how to replace a character of a string 
Python :: xml to python list in python 
Python :: positional only arguments python 
Python :: Remove an element from a Python list Using pop() method 
Python :: KeyError 
Python :: pybase64 
Python :: How to swap elements in a list in Python detailed 
Python :: instance of object 
Python :: list slicing in python 
Python :: stack.pop() 
Python :: comparison python 
Python :: floor python 
Python :: how to convert decimal to binary 
Python :: subtract constant from list 
Python :: create tab in python text 
ADD CONTENT
Topic
Content
Source link
Name
3+5 =