ladapetrushenko commited on
Commit
36fbe13
·
1 Parent(s): b309092

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -12
app.py CHANGED
@@ -2,26 +2,26 @@ import streamlit as st
2
  from construction_prediction.constants import load_w2v
3
  from construction_prediction.construction_calculator import get_collocates_for_word_type
4
 
5
- st.title('Калькулятор')
6
  form = st.form('Form')
7
- target_word = form.text_input(label='Введите целевое слово:',
8
- placeholder='Введите целевое слово',
9
  label_visibility='collapsed'
10
  )
11
- target_word_pos = form.selectbox(label='Укажите часть речи целевого слова:',
12
  options=['ADJ', 'ADVB', 'COMP', 'CONJ', 'GRND',
13
  'INFN', 'INTJ', 'NOUN', 'NPRO', 'NUMR',
14
  'None', 'PRCL', 'PRED', 'PREP', 'PRTF',
15
  'PRTS', 'VERB'],
16
  index=None,
17
- placeholder='Укажите часть речи целевого слова',
18
  label_visibility='collapsed'
19
  )
20
  current_model = form.selectbox(label='MODEL',
21
  options=['MODEL 1: nplus', 'MODEL 2: fontanka',
22
  'MODEL 3: librusec', 'MODEL 4: stihi_ru'],
23
  index=None,
24
- placeholder='Выберите модель подбора коллокатов',
25
  label_visibility='collapsed'
26
  )
27
  restrict_vocab = form.text_area(label='Restrict vocab',
@@ -29,25 +29,25 @@ restrict_vocab = form.text_area(label='Restrict vocab',
29
  placeholder='Restrict vocab',
30
  label_visibility='collapsed'
31
  )
32
- collocate_number = form.number_input(label='Количество коллокатов в выдаче:',
33
  min_value=1,
34
  step=1,
35
  value=10,
36
  format='%i',
37
- placeholder='Количество коллокатов в выдаче',
38
  # label_visibility='collapsed'
39
  )
40
- form_button = form.form_submit_button('Запустить')
41
 
42
  if form_button:
43
  if not target_word:
44
- st.error('Вы не ввели целевое слово')
45
  st.stop()
46
  if not target_word_pos:
47
- st.error('Вы не указали часть речи целевого слова')
48
  st.stop()
49
  if not current_model:
50
- st.error('Вы не выбрали модель')
51
  st.stop()
52
 
53
  if current_model == 'MODEL 1: nplus':
 
2
  from construction_prediction.constants import load_w2v
3
  from construction_prediction.construction_calculator import get_collocates_for_word_type
4
 
5
+ st.title('AdNounPredict')
6
  form = st.form('Form')
7
+ target_word = form.text_input(label='Input the target word:',
8
+ placeholder='Input the target word',
9
  label_visibility='collapsed'
10
  )
11
+ target_word_pos = form.selectbox(label='Specify the part of speech for the target word:',
12
  options=['ADJ', 'ADVB', 'COMP', 'CONJ', 'GRND',
13
  'INFN', 'INTJ', 'NOUN', 'NPRO', 'NUMR',
14
  'None', 'PRCL', 'PRED', 'PREP', 'PRTF',
15
  'PRTS', 'VERB'],
16
  index=None,
17
+ placeholder='Specify the part of speech for the target word',
18
  label_visibility='collapsed'
19
  )
20
  current_model = form.selectbox(label='MODEL',
21
  options=['MODEL 1: nplus', 'MODEL 2: fontanka',
22
  'MODEL 3: librusec', 'MODEL 4: stihi_ru'],
23
  index=None,
24
+ placeholder='Choose a collocate selection model',
25
  label_visibility='collapsed'
26
  )
27
  restrict_vocab = form.text_area(label='Restrict vocab',
 
29
  placeholder='Restrict vocab',
30
  label_visibility='collapsed'
31
  )
32
+ collocate_number = form.number_input(label='The number of collocates in the output:',
33
  min_value=1,
34
  step=1,
35
  value=10,
36
  format='%i',
37
+ placeholder='The number of collocates in the output',
38
  # label_visibility='collapsed'
39
  )
40
+ form_button = form.form_submit_button('Run')
41
 
42
  if form_button:
43
  if not target_word:
44
+ st.error("You didn't input the target word")
45
  st.stop()
46
  if not target_word_pos:
47
+ st.error("You didn't specify the part of speech for the target word")
48
  st.stop()
49
  if not current_model:
50
+ st.error("You didn't choose the model for the collocate selection")
51
  st.stop()
52
 
53
  if current_model == 'MODEL 1: nplus':