CallmeKaito commited on
Commit
95db319
1 Parent(s): a4d4377

Upload image_loader.py

Browse files
Files changed (1) hide show
  1. image_loader.py +21 -0
image_loader.py ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ import pandas as pd
3
+ from io import StringIO
4
+
5
+ uploaded_file = st.file_uploader("Choose a file")
6
+ if uploaded_file is not None:
7
+ # To read file as bytes:
8
+ bytes_data = uploaded_file.getvalue()
9
+ st.write(bytes_data)
10
+
11
+ # To convert to a string based IO:
12
+ stringio = StringIO(uploaded_file.getvalue().decode("utf-8"))
13
+ st.write(stringio)
14
+
15
+ # To read file as string:
16
+ string_data = stringio.read()
17
+ st.write(string_data)
18
+
19
+ # Can be used wherever a "file-like" object is accepted:
20
+ dataframe = pd.read_csv(uploaded_file)
21
+ st.write(dataframe)