changgun commited on
Commit
fd23c3d
β€’
1 Parent(s): 2cf1552
Files changed (1) hide show
  1. app.py +22 -8
app.py CHANGED
@@ -1,11 +1,25 @@
1
  import streamlit as st
 
2
 
3
- # adding the text that will show in the text box as default
4
- default_value = "See how a modern neural network auto-completes your text πŸ€— This site, built by the Hugging Face team, lets you write a whole document directly from your browser, and you can trigger the Transformer anywhere using the Tab key. Its like having a smart machine that completes your thoughts πŸ˜€ Get started by typing a custom snippet, check out the repository, or try one of the examples. Have fun!"
 
5
 
6
- sent = st.text_area("Text", default_value, height = 275)
7
- max_length = st.sidebar.slider("Max Length", min_value = 10, max_value=30)
8
- temperature = st.sidebar.slider("Temperature", value = 1.0, min_value = 0.0, max_value=1.0, step=0.05)
9
- top_k = st.sidebar.slider("Top-k", min_value = 0, max_value=5, value = 0)
10
- top_p = st.sidebar.slider("Top-p", min_value = 0.0, max_value=1.0, step = 0.05, value = 0.9)
11
- num_return_sequences = st.sidebar.number_input('Number of Return Sequences', min_value=1, max_value=5, value=1, step=1)
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  import streamlit as st
2
+ from datasets import load_dataset
3
 
4
+ def test_v01():
5
+ # adding the text that will show in the text box as default
6
+ default_value = "See how a modern neural network auto-completes your text πŸ€— This site, built by the Hugging Face team, lets you write a whole document directly from your browser, and you can trigger the Transformer anywhere using the Tab key. Its like having a smart machine that completes your thoughts πŸ˜€ Get started by typing a custom snippet, check out the repository, or try one of the examples. Have fun!"
7
 
8
+ sent = st.text_area("Text", default_value, height = 275)
9
+ max_length = st.sidebar.slider("Max Length", min_value = 10, max_value=30)
10
+ temperature = st.sidebar.slider("Temperature", value = 1.0, min_value = 0.0, max_value=1.0, step=0.05)
11
+ top_k = st.sidebar.slider("Top-k", min_value = 0, max_value=5, value = 0)
12
+ top_p = st.sidebar.slider("Top-p", min_value = 0.0, max_value=1.0, step = 0.05, value = 0.9)
13
+ num_return_sequences = st.sidebar.number_input('Number of Return Sequences', min_value=1, max_value=5, value=1, step=1)
14
+
15
+ def test_v02():
16
+ dataset = load_dataset("merve/poetry", streaming=True)
17
+ df = pd.DataFrame.from_dict(dataset["train"])
18
+ st.write("Most appearing words including stopwords")
19
+ st.bar_chart(words[0:50])
20
+ st.write("Number of poems for each author")
21
+ sns.catplot(x="author", data=df, kind="count", aspect = 4)
22
+ plt.xticks(rotation=90)
23
+ st.pyplot()
24
+
25
+ test_v02()