Notice
Recent Posts
Recent Comments
Link
| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 1 | 2 | 3 | 4 | 5 | 6 | 7 |
| 8 | 9 | 10 | 11 | 12 | 13 | 14 |
| 15 | 16 | 17 | 18 | 19 | 20 | 21 |
| 22 | 23 | 24 | 25 | 26 | 27 | 28 |
Tags
- append()
- del
- numpy
- nan
- 덴드로그램
- elbow method
- analizer
- list
- Dictionary
- Python
- count()
- Machine Learning
- IN
- dendrogram
- wcss
- DataAccess
- len()
- DataFrame
- 반복문
- insert()
- pandas
- 분류 결과표
- function
- string
- 최댓값
- 최솟값
- matplotlib
- hierarchical_clustering
- data
- sklearn
Archives
- Today
- Total
개발공부
[Streamlit] 이미지, 비디오, 오디오 파일 출력하기 본문
이미지 - streamlit의 image() 함수
import streamlit as st
# 이미지 처리를 위한 라이브러리
from PIL import Image
def main():
# 1. 저장되어있는 이미지 파일을 화면에 표시하기
img = Image.open('data2/image_03.jpg')
st.image(img)
# 너비가 화면에 꽉차게
st.image(img, use_column_width= True)
if __name__ == '__main__':
main()

import streamlit as st
# 이미지 처리를 위한 라이브러리
from PIL import Image
def main():
# 2. 인터넷 상에 있는 이미지를 화면에 표시하기.
# URL이 있는 이미지를 말한다.
img_url = 'https://asset-a.grid.id//crop/0x0:0x0/700x465/photo/bobofoto/original/9973_panda-berbulu-cokelat.jpg'
st.image(img_url)
if __name__ == '__main__':
main()

비디오 - streamlit의 video() 함수
import streamlit as st
def main():
video_file = open('data2/secret_of_success.mp4', 'rb')
st.video(video_file)
if __name__ == '__main__':
main()

오디오 - streamlit의 audio() 함수
import streamlit as st
def main():
audio_file = open('data2/song.mp3', 'rb')
st.audio(audio_file.read(), format='audio/mp3')
if __name__ == '__main__':
main()

'Python > Streamlit' 카테고리의 다른 글
| [Streamlit] 파일을 업로드 하는 방법, 사이드 바 만들기 (0) | 2022.05.23 |
|---|---|
| [Streamlit] 유저에게 입력 받는 방법(문자, 숫자, 날짜, 시간, 색깔, 비밀번호) (0) | 2022.05.23 |
| [Streamlit] 익스펜더(Expander) 만들기 (0) | 2022.05.20 |
| [Streamlit] 슬라이더(Slider) 만들기 (0) | 2022.05.20 |
| [Streamlit] 멀티 셀렉트(Multiselect) 만들기 (0) | 2022.05.20 |