PierreCugnet commited on
Commit
2f6e3a1
1 Parent(s): f4e514f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -2
app.py CHANGED
@@ -1,4 +1,17 @@
1
  import streamlit as st
 
2
 
3
- x = st.slider('Select a value')
4
- st.write(x, 'squared is', x * x)
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  import streamlit as st
2
+ import os
3
 
4
+ def file_selector(folder_path='.'):
5
+ filenames = os.listdir(folder_path)
6
+ selected_filename = st.selectbox('Select a file', filenames)
7
+ return os.path.join(folder_path, selected_filename)
8
+
9
+
10
+ if __name__ == '__main__':
11
+ # Select a file
12
+ if st.checkbox('Select a file in current directory'):
13
+ folder_path = '.'
14
+ if st.checkbox('Change directory'):
15
+ folder_path = st.text_input('Enter folder path', '.')
16
+ filename = file_selector(folder_path=folder_path)
17
+ st.write('You selected `%s`' % filename)