Spaces:
Runtime error
Runtime error
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
from streamlit_tags import st_tags, st_tags_sidebar
|
3 |
+
|
4 |
+
st.write("# Code for streamlit tags")
|
5 |
+
|
6 |
+
st.code(body='''keywords = st_tags(
|
7 |
+
label='# Enter Keywords:',
|
8 |
+
text='Press enter to add more',
|
9 |
+
value=['Zero', 'One', 'Two'],
|
10 |
+
suggestions=['five', 'six', 'seven', 'eight', 'nine', 'three', 'eleven', 'ten', 'four'],
|
11 |
+
maxtags = 4,
|
12 |
+
key='1')''',
|
13 |
+
language="python")
|
14 |
+
|
15 |
+
maxtags = st.slider('Number of tags allowed?', 1, 10, 3, key='1')
|
16 |
+
|
17 |
+
keywords = st_tags(
|
18 |
+
label='# Enter Keywords:',
|
19 |
+
text='Press enter to add more',
|
20 |
+
value=['Zero', 'One', 'Two'],
|
21 |
+
suggestions=['five', 'six', 'seven', 'eight', 'nine', 'three', 'eleven', 'ten', 'four'],
|
22 |
+
maxtags=maxtags,
|
23 |
+
key="aljnf")
|
24 |
+
|
25 |
+
st.write("### Results:")
|
26 |
+
st.write(keywords)
|
27 |
+
|
28 |
+
st.sidebar.write("# Code for streamlit tags sidebar")
|
29 |
+
|
30 |
+
st.sidebar.code(body='''keyword = st_tags_sidebar(
|
31 |
+
label='# Enter Keywords:',
|
32 |
+
text='Press enter to add more',
|
33 |
+
value=['Zero', 'One', 'Two'],
|
34 |
+
suggestions=['five', 'six', 'seven',
|
35 |
+
'eight', 'nine', 'three',
|
36 |
+
'eleven', 'ten', 'four'],
|
37 |
+
maxtags = 4)''',
|
38 |
+
language="python")
|
39 |
+
|
40 |
+
maxtags_sidebar = st.sidebar.slider('Number of tags allowed?', 1, 10, 3, key='2')
|
41 |
+
|
42 |
+
|
43 |
+
keyword = st_tags_sidebar(label='# Enter Keywords:',
|
44 |
+
text='Press enter to add more',
|
45 |
+
value=['Zero', 'One', 'Two'],
|
46 |
+
suggestions=['five', 'six', 'seven', 'eight', 'nine', 'three', 'eleven', 'ten', 'four'],
|
47 |
+
maxtags=maxtags_sidebar,
|
48 |
+
key="afrfae")
|
49 |
+
|
50 |
+
st.sidebar.write("### Results:")
|
51 |
+
st.sidebar.write(keyword)
|