Spaces:
Sleeping
Sleeping
File Uploader (#5)
Browse files- Add a file uploader sample (7657e9d4891015119c5ae8b06f73ba8fa25ffab7)
- Add command line arguments such as `--server.enableXsrfProtection false` that are necessary or suitable for HF Spaces (1f5003f862ef166904510feb32676b55c5a5de2b)
Co-authored-by: Yuichiro Tachibana <[email protected]>
- Dockerfile +5 -1
- app.py +6 -0
Dockerfile
CHANGED
@@ -20,4 +20,8 @@ WORKDIR $HOME/app
|
|
20 |
COPY . $HOME/app
|
21 |
|
22 |
EXPOSE 8501
|
23 |
-
CMD streamlit run app.py
|
|
|
|
|
|
|
|
|
|
20 |
COPY . $HOME/app
|
21 |
|
22 |
EXPOSE 8501
|
23 |
+
CMD streamlit run app.py \
|
24 |
+
--server.headless true \
|
25 |
+
--server.enableCORS false \
|
26 |
+
--server.enableXsrfProtection false \
|
27 |
+
--server.fileWatcherType none
|
app.py
CHANGED
@@ -34,3 +34,9 @@ filtered_data = data[data[DATE_COLUMN].dt.hour == hour_to_filter]
|
|
34 |
|
35 |
st.subheader('Map of all pickups at %s:00' % hour_to_filter)
|
36 |
st.map(filtered_data)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
|
35 |
st.subheader('Map of all pickups at %s:00' % hour_to_filter)
|
36 |
st.map(filtered_data)
|
37 |
+
|
38 |
+
uploaded_file = st.file_uploader("Choose a file")
|
39 |
+
if uploaded_file is not None:
|
40 |
+
st.write(uploaded_file.name)
|
41 |
+
bytes_data = uploaded_file.getvalue()
|
42 |
+
st.write(len(bytes_data), "bytes")
|