-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstream.py
More file actions
126 lines (99 loc) · 3.93 KB
/
stream.py
File metadata and controls
126 lines (99 loc) · 3.93 KB
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
# Streamlit library for building and deploying web apps in Python -> locally as well as in the cloud.
import streamlit as st
import pandas as pd
import numpy as np
st.title("My First Streamlit App(Title)")
st.header("This is a header(Header)")
st.subheader("This is a subheader(Subheader)")
st.text("This is a simple text(Text)")
st.markdown("### This is a markdown")
st.caption("This is a caption")
st.write("Hello, welcome to Streamlit!")
st.image("https://streamlit.io/images/brand/streamlit-mark-color.png", width=200)
st.video("https://www.youtube.com/watch?v=JwSS70SZdyM")
st.audio("https://www.soundhelix.com/examples/mp3/SoundHelix-Song-1.mp3")
st.checkbox("Check me out!")
st.button("Click me!")
st.radio("Choose one:", ("Option 1", "Option 2", "Option 3"))
st.selectbox("Select an option:", ("Option A", "Option B", "Option C"))
st.multiselect("Select multiple options:", ("Option X", "Option Y", "Option Z"))
st.select_slider("Select a range:", ("Low", "Medium", "High"))
st.slider("Select a value:", 0, 100, 50)
on = st.toggle("Activate feature")
if on:
st.write("Feature is activated!")
number = st.number_input('Insert a number')
st.write(f'You inserted: {number}')
date = st.date_input("Select a date")
st.write(f'You selected: {date}')
time = st.time_input("Select a time")
st.write(f'You selected: {time}')
st.number_input("Enter a number:", min_value=0, max_value=100, value=25, step=5)
st.text_input("Enter some text:")
st.date_input("Pick a date:")
st.time_input("Pick a time:")
st.file_uploader("Upload a file:")
st.color_picker("Pick a color:")
st.success("This is a success message!")
st.error("This is an error message!")
st.warning("This is a warning message!")
st.info("This is an informational message.")
st.exception("This is an exception message!")
st.sidebar.title("Sidebar Title")
st.sidebar.header("Sidebar Header")
st.sidebar.subheader("Sidebar Subheader")
st.sidebar.text("This is some sidebar text.")
st.sidebar.markdown("### Sidebar Markdown")
st.sidebar.image("https://streamlit.io/images/brand/streamlit-mark-color.png", width=100)
df = pd.DataFrame(np.random.randn(50,20), columns=(f'col {i}' for i in range(20)))
st.dataframe(df)
df = pd.DataFrame({
'Column A': [1, 2, 3, 4],
'Column B': [10, 20, 30, 40]
})
st.table(df)
col1, col2, col3 = st.columns(3)
col1.metric("Temperature", "70 °F", "1.2 °F")
col2.metric("Humidity", "50 %", "-3 %")
col3.metric("Wind Speed", "15 mph", "2 mph")
prompt = st.chat_input("Ask me anything:")
if prompt:
st.chat_message("user").markdown(prompt)
response = f"You asked: {prompt}"
st.chat_message("assistant").markdown(response)
# with st.status('step 1'):
# st.write('step 2')
# time.sleep(1)
# st.write('step 3')
# time.sleep(1)
# st.write('step 4')
# time.sleep(1)
# st.button('Rerun')
chart_data = pd.DataFrame(np.random.randn(20, 3), columns=['a', 'b', 'c'])
st.line_chart(chart_data)
st.area_chart(chart_data)
chart_data = pd.DataFrame(np.random.randn(50, 3), columns=['a', 'b', 'c'])
st.bar_chart(chart_data)
df = pd.DataFrame(
np.random.randn(1000, 2) / [50, 50] + [37.76, -122.4],
columns=['lat', 'lon']
)
st.map(df)
with st.expander("See explanation"):
st.write("""
Here is some more information about the topic.
""")
st.image("https://streamlit.io/images/brand/streamlit-mark-color.png", width=100)
st.video("https://www.youtube.com/watch?v=JwSS70SZdyM")
st.audio("https://www.soundhelix.com/examples/mp3/SoundHelix-Song-1.mp3")
st.write("You can put any Streamlit command inside the expander!")
st.progress(0)
import time
for i in range(10):
time.sleep(0.1)
st.progress(i + 1)
st.balloons()
chart_data = pd.DataFrame(np.random.randn(20, 3), columns=['a', 'b', 'c'])
st.scatter_chart(chart_data)
with st.chat_message("assistant"):
st.markdown("Hello! How can I assist you today?")