Framby commited on
Commit
474bcaa
·
verified ·
1 Parent(s): eac340a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -3
app.py CHANGED
@@ -1,5 +1,6 @@
1
  import requests
2
  import os
 
3
  import streamlit as st
4
  import pandas as pd
5
  import numpy as np
@@ -80,15 +81,16 @@ st.markdown("## 1. Analyse des données textuelles")
80
  col1, col2 = st.columns(2)
81
 
82
  with col1:
83
- st.markdown("### Distribution de la longueur des questions")
84
  text_lengths = X.apply(lambda x: len(x.split()))
85
  df_lengths = pd.DataFrame({'length': text_lengths})
86
  fig = px.histogram(df_lengths, x='length', nbins=30, title="Distribution de la longueur des questions")
87
  st.plotly_chart(fig, use_container_width=True)
88
 
89
  with col2:
90
- st.markdown("### Tags les plus fréquents")
91
- all_tags = [tag for sublist in Y for tag in sublist]
 
92
  tag_freq = Counter(all_tags)
93
  most_common_tags = pd.DataFrame(
94
  tag_freq.most_common(20), columns=['Tag', 'Nombre'])
 
1
  import requests
2
  import os
3
+ import ast
4
  import streamlit as st
5
  import pandas as pd
6
  import numpy as np
 
81
  col1, col2 = st.columns(2)
82
 
83
  with col1:
84
+ st.markdown("### Questions")
85
  text_lengths = X.apply(lambda x: len(x.split()))
86
  df_lengths = pd.DataFrame({'length': text_lengths})
87
  fig = px.histogram(df_lengths, x='length', nbins=30, title="Distribution de la longueur des questions")
88
  st.plotly_chart(fig, use_container_width=True)
89
 
90
  with col2:
91
+ st.markdown("### Tags")
92
+ parsed_tags = Y.apply(ast.literal_eval)
93
+ all_tags = [tag for sublist in parsed_tags for tag in sublist]
94
  tag_freq = Counter(all_tags)
95
  most_common_tags = pd.DataFrame(
96
  tag_freq.most_common(20), columns=['Tag', 'Nombre'])