sy-lac commited on
Commit
f1c221e
1 Parent(s): 5a28e60

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -5
app.py CHANGED
@@ -29,7 +29,7 @@ from sklearn.metrics.pairwise import cosine_similarity
29
  # nombre de mots et de mots uniques
30
  def number_words(text):
31
  word = text.split()
32
- return 'Nombre de mots : {} / Nombre de mots uniques : {}'.format(len(word), len(Counter(word)))
33
 
34
  # polarité
35
  def polarity(text):
@@ -150,19 +150,21 @@ def analyze_text(text):
150
  st.title("Text Analysis and Summary")
151
  text = st.text_area("Enter text here:")
152
 
153
- if st.button("Analyze"):
 
 
154
  if text:
155
  nb_mots, polarite, subjectivite, mots_cles, resume1, resume2 = analyze_text(text)
156
 
157
  st.write(nb_mots)
158
  st.write(polarite)
159
  st.write(subjectivite)
160
- st.write("List without square brackets and single quotes:")
161
- st.write(f'Mots clés : {mots_cles}')
162
  st.write(f'Résumé 1 : {resume1}')
163
  st.write(f'Résumé 2 : {resume2}')
164
 
165
- if st.button("Clear Text Area"):
166
  text = ""
167
 
 
168
 
 
29
  # nombre de mots et de mots uniques
30
  def number_words(text):
31
  word = text.split()
32
+ return 'Nombre de mots : {} - Nombre de mots uniques : {}'.format(len(word), len(Counter(word)))
33
 
34
  # polarité
35
  def polarity(text):
 
150
  st.title("Text Analysis and Summary")
151
  text = st.text_area("Enter text here:")
152
 
153
+ col1, col2 = st.beta_columns(2)
154
+
155
+ if col1.button("Analyze"):
156
  if text:
157
  nb_mots, polarite, subjectivite, mots_cles, resume1, resume2 = analyze_text(text)
158
 
159
  st.write(nb_mots)
160
  st.write(polarite)
161
  st.write(subjectivite)
162
+ st.write('Mots clés :', ', '.join(mots_cles))
 
163
  st.write(f'Résumé 1 : {resume1}')
164
  st.write(f'Résumé 2 : {resume2}')
165
 
166
+ if col2.button("Clear Text Area"):
167
  text = ""
168
 
169
+ st.text_area("Enter text here:", value=text)
170