-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
76 lines (62 loc) · 1.92 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta
name="viewport"
content="width=device-width, initial-scale=1, shrink-to-fit=no"
/>
<title>stlite app</title>
<link
rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/@stlite/[email protected]/build/stlite.css"
/>
</head>
<body>
<div id="root"></div>
<script src="https://cdn.jsdelivr.net/npm/@stlite/[email protected]/build/stlite.js"></script>
<script>
stlite.mount(
{
requirements: ["plotly", "matplotlib"], // Packages to install
entrypoint: "test_app.py", // The target file of the `streamlit run` command
files: { "test_app.py": `
import streamlit as st
import pandas as pd
import random
import plotly.express as px
import matplotlib as plt
# Text input for name
chart_title= st.text_input('Chart title')
# Button to scramble name
if st.button('Scramble me mucka'):
chart_title= list(chart_title) # Convert string to list
random.shuffle(chart_title) # Shuffle list
chart_title= ''.join(chart_title) # Convert list back to string
st.write(f'Hello, {chart_title}!')
uploaded_file = st.file_uploader("Choose a file", accept_multiple_files=False, type=['png', 'jpg', 'csv', 'xlsx'])
if uploaded_file:
st.write("filename:", uploaded_file.name)
df = pd.read_csv(uploaded_file)
st.dataframe(df)
with st.sidebar:
option1 = st.sidebar.selectbox(
'What Category...',
(df['category'].unique()))
df = df[df['category'] == option1]
with st.sidebar:
option2 = st.sidebar.selectbox(
'What Category_type...',
(df['category_type'].unique()))
df = df[df['category_type'] == option2]
fig = px.line(df, x='time_period', y='number', title = chart_title)
st.plotly_chart(fig)
`,
},
},
document.getElementById("root")
);
</script>
</body>
</html>