# -*- coding: utf-8 -*-
import streamlit as st
import time
import datetime
import os
import glob
import cv2
from PIL import Image
from datetime import datetime, date, time
PATH='/home/mars/pWork/DATA/'
def disp(device):
cap = cv2.VideoCapture(device)
image_loc = st.empty()
while cap.isOpened:
ret, img = cap.read()
if ret:
img = Image.fromarray(cv2.cvtColor(img, cv2.COLOR_BGR2RGB))
image_loc.image(img)
else:
break
cap.release()
st.button('Replay')
def main():
st.header("流星観測データの表示")
date=st.date_input('Select date')
path=PATH+date.strftime("%Y%m%d")
#st.write(path)
if os.path.exists(path):
files=glob.glob(path+'/*avi')
option = st.selectbox('Select file:',files)
disp(option)
else:
st.write('No data exists!')
if __name__ == '__main__':
main()
ファイルの選択対象を、様々な条件で絞りこむコードを追加したい。