Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,42 +1,10 @@
|
|
1 |
import streamlit as st
|
2 |
-
import pandas as pd
|
3 |
-
import numpy as np
|
4 |
|
5 |
-
|
|
|
|
|
6 |
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
@st.cache_data
|
12 |
-
def load_data(nrows):
|
13 |
-
data = pd.read_csv(DATA_URL, nrows=nrows)
|
14 |
-
lowercase = lambda x: str(x).lower()
|
15 |
-
data.rename(lowercase, axis='columns', inplace=True)
|
16 |
-
data[DATE_COLUMN] = pd.to_datetime(data[DATE_COLUMN])
|
17 |
-
return data
|
18 |
-
|
19 |
-
data_load_state = st.text('Loading data...')
|
20 |
-
data = load_data(10000)
|
21 |
-
data_load_state.text("Done! (using st.cache)")
|
22 |
-
|
23 |
-
if st.checkbox('Show raw data'):
|
24 |
-
st.subheader('Raw data')
|
25 |
-
st.write(data)
|
26 |
-
|
27 |
-
st.subheader('Number of pickups by hour')
|
28 |
-
hist_values = np.histogram(data[DATE_COLUMN].dt.hour, bins=24, range=(0,24))[0]
|
29 |
-
st.bar_chart(hist_values)
|
30 |
-
|
31 |
-
# Some number in the range 0-23
|
32 |
-
hour_to_filter = st.slider('hour', 0, 23, 17)
|
33 |
-
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)
|
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")
|
|
|
1 |
import streamlit as st
|
|
|
|
|
2 |
|
3 |
+
# Simple Streamlit app
|
4 |
+
st.title("Simple Streamlit App")
|
5 |
+
st.write("Hello, Dockerized Streamlit World!")
|
6 |
|
7 |
+
# Input example
|
8 |
+
name = st.text_input("Enter your name:")
|
9 |
+
if name:
|
10 |
+
st.write(f"Hello, {name}!")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|