12345678910111213141516171819202122232425 |
- import streamlit as st
- import os
- fingermodel_trans = {
- '一般抓握': 'flex',
- '柱状抓握': 'cylinder',
- '球状抓握': 'ball',
- '两指对捏': 'double',
- '三指对捏': 'treble'
- }
- def file_selector(folder_path='.'):
- try:
- os.mkdir(folder_path)
- except FileExistsError:
- pass
- filenames = os.listdir(folder_path)
- filenames = filter(lambda x: x.endwith('.pkl'), filenames)
- selected_filename = st.selectbox('Select a file', filenames)
- if selected_filename is not None:
- return os.path.join(folder_path, selected_filename)
- else:
- return None
|