jitesh commited on
Commit
bf1d936
1 Parent(s): 1061dba

adds selectbox for first sentence

Browse files
Files changed (1) hide show
  1. app.py +19 -11
app.py CHANGED
@@ -16,17 +16,25 @@ container_button = st.sidebar.container()
16
  mode = container_mode.radio(
17
  "Select your mode",
18
  ('Create Statistics', 'Play Storytelling'), index=0)
19
- story_till_now = st.text_input(
20
- label='First Sentence',
21
- value=random.choice([
22
- 'Hello, I\'m a language model,',
23
- 'So I suppose you want to ask me how I did it.',
24
- 'I always wanted to be a giraffe - until that night.',
25
- 'My first tutor was a dragon with a terrible sense of humor.',
26
- 'Doctors told her she could never diet again.',
27
- 'Memory is all around us, as well as within.',
 
 
 
 
 
 
 
 
 
28
 
29
- ]))
30
 
31
  num_generation = container_param.slider(
32
  label='Number of generation', min_value=1, max_value=100, value=5, step=1)
@@ -57,7 +65,7 @@ if mode == 'Create Statistics':
57
  # st.plotly_chart(fig2, use_container_width=True)
58
  if len(gen.data) > 0:
59
  for si, story in enumerate(gen.data):
60
- st.markdown(f'### Story no. {si}:', unsafe_allow_html=False)
61
  for i, sentence in enumerate(story):
62
  col_turn, col_sentence, col_emo = st.columns([1, 8, 2])
63
  col_turn.markdown(
 
16
  mode = container_mode.radio(
17
  "Select your mode",
18
  ('Create Statistics', 'Play Storytelling'), index=0)
19
+ choices_first_sentence = [
20
+ 'Custom',
21
+ 'Hello, I\'m a language model,',
22
+ 'So I suppose you want to ask me how I did it.',
23
+ 'I always wanted to be a giraffe - until that night.',
24
+ 'My first tutor was a dragon with a terrible sense of humor.',
25
+ 'Doctors told her she could never diet again.',
26
+ 'Memory is all around us, as well as within.',
27
+
28
+
29
+ ]
30
+ cfs = st.selectbox('Choose First Sentence', choices_first_sentence)
31
+ if cfs == 'Custom':
32
+ story_till_now = st.text_input(
33
+ label='First Sentence', key='first_sentence')
34
+ else:
35
+ st.session_state.first_sentence = cfs
36
+ story_till_now = cfs
37
 
 
38
 
39
  num_generation = container_param.slider(
40
  label='Number of generation', min_value=1, max_value=100, value=5, step=1)
 
65
  # st.plotly_chart(fig2, use_container_width=True)
66
  if len(gen.data) > 0:
67
  for si, story in enumerate(gen.data):
68
+ st.markdown(f'### Story {si}:', unsafe_allow_html=False)
69
  for i, sentence in enumerate(story):
70
  col_turn, col_sentence, col_emo = st.columns([1, 8, 2])
71
  col_turn.markdown(