저장되어있는 이미지 파일을 화면에 표시하는 방법
import streamlit as st
# 이미지 처리를 위한 라이브러리
from PIL import Image
def main():
img = Image.open('./data/image_03.jpg')
st.image(img)
st.image(img, width=500)
st.image(img, use_column_width=True)
인터넷상에 있는 이미지를 화면에 표시하는 방법
# 인터넷상의 이미지 : URL 이 있다!
url = 'https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcRHrpRSfTLi2rBRndWJXQmrbGre27t-U16xRg&s'
st.image(url)
동영상 파일
video_file = open('./data/video1.mp4', 'rb')
st.video(video_file)
오디오 파일
audio_file = open('./data/song.mp3', 'rb')
st.audio(audio_file.read(), format='audio/mp3')
'Python > Streamlit' 카테고리의 다른 글
[Python] Streamlit 파일 업로드 (0) | 2024.04.24 |
---|---|
[Python] Streamlit 유저한테 데이터 입력 받기 (0) | 2024.04.23 |
[Python] Streamlit UI 함수, 위젯 ( button, radio, checkbox, selectbox, multiselect, slider, expander ) (0) | 2024.04.23 |
[Python] Streamlit 웹 화면에 DataFrame 출력 (0) | 2024.04.23 |
[Python] Streamlit 텍스트(title, text, header, subheader... ) (0) | 2024.04.23 |