Spaces:
Sleeping
Sleeping
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
# To make things easier later, we're also importing numpy and pandas for
|
3 |
+
# working with sample data.
|
4 |
+
import numpy as np
|
5 |
+
import pandas as pd
|
6 |
+
|
7 |
+
st.title('My first app')
|
8 |
+
|
9 |
+
st.write("Here's our first attempt at using data to create a table:")
|
10 |
+
|
11 |
+
df = pd.DataFrame({
|
12 |
+
'first column': [1, 2, 3, 4],
|
13 |
+
'second column': [10, 20, 30, 40]
|
14 |
+
})
|
15 |
+
|
16 |
+
st.write(df)
|
17 |
+
|
18 |
+
if st.checkbox('Show dataframe'):
|
19 |
+
chart_data = pd.DataFrame(
|
20 |
+
np.random.randn(20, 3),
|
21 |
+
columns=['a', 'b', 'c'])
|
22 |
+
|
23 |
+
chart_data
|
24 |
+
|
25 |
+
|
26 |
+
option = st.selectbox(
|
27 |
+
'Which number do you like best?',
|
28 |
+
df['first column'])
|
29 |
+
|
30 |
+
st.write('You selected: ', option)
|
31 |
+
|
32 |
+
text1 = st.text('This is some text.')
|
33 |
+
|
34 |
+
if st.button('Say hello'):
|
35 |
+
st.write('Why hello there')
|
36 |
+
else:
|
37 |
+
st.write('Goodbye')
|
38 |
+
|
39 |
+
|
40 |
+
agree = st.checkbox('I agree')
|
41 |
+
|
42 |
+
if agree:
|
43 |
+
st.write('Great!')
|
44 |
+
|
45 |
+
age = st.slider('How old are you?', 0, 130, 25)
|
46 |
+
|
47 |
+
st.write("I'm ", age, 'years old')
|
48 |
+
|
49 |
+
title = st.text_input('Movie title', 'Life of Brian')
|
50 |
+
|
51 |
+
st.write('The current movie title is', title)
|
52 |
+
|
53 |
+
number = st.number_input('Insert a number')
|
54 |
+
|
55 |
+
st.write('The current number is ', number)
|
56 |
+
|