File size: 3,656 Bytes
77b6511 4d3626f 77b6511 f1a4d7d 77b6511 04df63e 77b6511 04df63e 77b6511 04df63e 77b6511 5987611 77b6511 5987611 77b6511 4d3626f 77b6511 5987611 77b6511 5987611 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 | import streamlit as st
import pandas as pd
import plotly.express as px
import random
import plotly.graph_objects as go
import streamlit.components.v1 as components
import requests
import numpy as np
from streamlit_lottie import st_lottie
st.set_page_config(layout="wide")
def load_lottie_url(url: str):
r = requests.get(url)
if r.status_code != 200:
return None
return r.json()
# Chargement des données
@st.cache_data
# Fonction pour charger les différents datasets
def load_data():
# Chemins des fichiers
path_complete = r'cleaned_merged_data.csv'
path_opinions = r'opinions.csv'
# Chargement du dataset complet
df_complete = pd.read_csv(path_complete)
df_complete.dropna(inplace=True) # Nettoyage des données, si nécessaire
# Chargement du dataset des opinions
df_opinions = pd.read_csv(path_opinions)
df_opinions.dropna(inplace=True) # Nettoyage des données, si nécessaire
return df_complete, df_opinions
# Chargement des trois instances de dataframe
df, df_opinions = load_data()
# CSS personnalisé
custom_css = """
<style>
/* Personnaliser les titres */
.block-container {
padding-top: 1rem;
padding-bottom: 0rem;
padding-left: 5rem;
padding-right: 5rem;
}
h1 {
color: #002c4d;
}
[data-testid="stDecoration"] {
display: none;
}
h2 {
color: #002c4d;
border-bottom: 2px solid #002c4d;
}
/* Personnaliser le bouton */
.stButton button {
background-color: #002c4d !important;
color: white !important;
border-radius: 5px !important;
border: none !important;
padding: 8px 15px !important;
font-size: 16px !important;
}
/* Personnaliser le fond */
body {
background-color: white !important;
}
/* Ajouter plus de padding-top aux paragraphes */
.custom-paragraph {
padding-top: 20px;
}
</style>
"""
# Injecter le CSS personnalisé dans l'application
st.markdown(custom_css, unsafe_allow_html=True)
coll1,coll2,coll3= st.columns([1,4,1])
with coll2:
col1,col2= st.columns([2,5])
with col1:
lottie_animation_1 = "https://assets1.lottiefiles.com/packages/lf20_5mhyg2hz.json"
lottie_anime_json = load_lottie_url(lottie_animation_1)
st_lottie(lottie_anime_json, key="logo")
with col2:
for _ in range(3): # Ajustez le nombre de lignes selon le besoin
st.write("")
st.title('Explore Our Datasets')
# Titre principal et introduction
st.header('Description of our Data')
st.write(" ")
st.write("""
The data presented here were used in our TER project, focused on analyzing the controversy on Twitter. They allowed us to perform various analyses such as:
- Sentiment and emotion analysis: to understand user reactions.
- Social network analysis: to capture the links between hashtags and tweet clusters based on LDA analysis.
- Statistical analysis: which allowed us to connect our previous work through the controversy index, which attempts to quantify the level of controversy of a tweet.""")
# Affichage des datasets
# Vous pouvez remplacer 'df', 'df_opinions', et 'df_controversy_index' par vos variables de dataframe réelles
st.header('Check our Datasets !')
# Ajouter un sélecteur pour le dataset à afficher
dataset_choice = st.selectbox('Select the dataset you want to view:',
['Complete Dataset', 'Opinions Dataset'])
if dataset_choice == 'Complete Dataset':
st.subheader('Complete Dataset')
st.dataframe(df)
elif dataset_choice == 'Opinions Dataset':
st.subheader('Opinions Dataset')
st.dataframe(df_opinions)
|