Pietro Lesci commited on
Commit
a66b528
1 Parent(s): e952967

enhance: UI of FAQ and HOME

Browse files
Files changed (2) hide show
  1. src/pages/faq.py +16 -2
  2. src/pages/home.py +24 -6
src/pages/faq.py CHANGED
@@ -4,11 +4,25 @@ from src.configs import Languages
4
 
5
  def write(*args):
6
 
7
- # ==== HPW IT WORKS ==== #
8
  with st.beta_container():
9
  st.markdown("")
10
  st.markdown("")
11
- st.header("How it works")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
12
  st.subheader("Step 1 - Prepare your data")
13
  st.markdown(
14
  """
 
4
 
5
  def write(*args):
6
 
7
+ # ==== HOW IT WORKS ==== #
8
  with st.beta_container():
9
  st.markdown("")
10
  st.markdown("")
11
+ st.markdown(
12
+ """
13
+ Wordify makes it easy to identify words that discriminate categories in textual data.
14
+
15
+ Let's explain Wordify with an example. Imagine you are thinking about having a glass
16
+ of wine :wine_glass: with your friends :man-man-girl-girl: and you have to buy a bottle.
17
+ You know you like `bold`, `woody` wine but are unsure which one to choose.
18
+ You wonder whether there are some words that describe each type of wine.
19
+ Since you are a researcher :female-scientist: :male-scientist:, you decide to approach
20
+ the problem scientifically :microscope:. That's where Wordify comes to the rescue!
21
+ """
22
+ )
23
+ st.markdown("")
24
+ st.markdown("")
25
+ st.header("Steps")
26
  st.subheader("Step 1 - Prepare your data")
27
  st.markdown(
28
  """
src/pages/home.py CHANGED
@@ -7,7 +7,6 @@ from src.utils import (
7
  plot_labels_prop,
8
  plot_nchars,
9
  plot_score,
10
- get_logo,
11
  read_file,
12
  )
13
  import streamlit as st
@@ -15,6 +14,22 @@ import streamlit as st
15
 
16
  def write(session, uploaded_file):
17
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18
  if uploaded_file:
19
 
20
  # 1. READ FILE
@@ -41,7 +56,8 @@ def write(session, uploaded_file):
41
  st.markdown("Select the column containing the label")
42
 
43
  if label_column:
44
- st.altair_chart(plot_labels_prop(data, label_column), use_container_width=True)
 
45
 
46
  with col3:
47
  text_column = st.selectbox("Select text column name", cols_options, index=0)
@@ -123,11 +139,13 @@ def write(session, uploaded_file):
123
  st.warning("Please select `label` and `text` columns")
124
 
125
  elif run_button and (label_column and text_column) and not session.process:
126
- # data = data.head()
127
- data[f"preprocessed_{text_column}"] = preprocessor.fit_transform(data[text_column]).values
128
 
129
- inputs = encode(data[f"preprocessed_{text_column}"], data[label_column])
130
- session.posdf, session.negdf = wordifier(**inputs)
 
 
 
 
131
  st.success("Wordified!")
132
 
133
  # session.posdf, session.negdf = process(data, text_column, label_column)
 
7
  plot_labels_prop,
8
  plot_nchars,
9
  plot_score,
 
10
  read_file,
11
  )
12
  import streamlit as st
 
14
 
15
  def write(session, uploaded_file):
16
 
17
+ st.markdown(
18
+ """
19
+ Hi! Welcome to __Wordify__. Start by uploading a file - CSV, XLSX (avoid Strict Open XML Spreadsheet format [here](https://stackoverflow.com/questions/62800822/openpyxl-cannot-read-strict-open-xml-spreadsheet-format-userwarning-file-conta)),
20
+ or PARQUET are currently supported.
21
+
22
+ Once you have uploaded the file, __Wordify__ will show an interactive UI through which
23
+ you'll be able to interactively decide the text preprocessing steps, their order, and
24
+ proceed to Wordify your text.
25
+
26
+ If you're ready, let's jump in:
27
+
28
+ :point_left: upload a file via the upload widget in the sidebar!
29
+
30
+ NOTE: whenever you want to reset everything, simply refresh the page
31
+ """
32
+ )
33
  if uploaded_file:
34
 
35
  # 1. READ FILE
 
56
  st.markdown("Select the column containing the label")
57
 
58
  if label_column:
59
+ plot = plot_labels_prop(data, label_column)
60
+ if plot: st.altair_chart(plot, use_container_width=True)
61
 
62
  with col3:
63
  text_column = st.selectbox("Select text column name", cols_options, index=0)
 
139
  st.warning("Please select `label` and `text` columns")
140
 
141
  elif run_button and (label_column and text_column) and not session.process:
 
 
142
 
143
+ with st.spinner("Process started"):
144
+ # data = data.head()
145
+ data[f"preprocessed_{text_column}"] = preprocessor.fit_transform(data[text_column]).values
146
+
147
+ inputs = encode(data[f"preprocessed_{text_column}"], data[label_column])
148
+ session.posdf, session.negdf = wordifier(**inputs)
149
  st.success("Wordified!")
150
 
151
  # session.posdf, session.negdf = process(data, text_column, label_column)