File size: 5,610 Bytes
c8c3cc4
 
 
d0661bd
c4b812c
d63f1d2
9157013
318964b
c8c3cc4
fab5009
b7289c6
17b2024
fcbb419
72b2576
98691d1
 
 
fab5009
 
 
 
fb86b93
d9e40cd
fda58da
19341ef
fcbb419
64cd369
17b2024
 
0dc8c45
 
17b2024
 
 
 
 
 
98691d1
0527fa6
439e01f
17b2024
 
 
 
e516684
 
 
 
 
 
 
 
 
fab5009
72b2576
 
 
d9e40cd
 
72b2576
 
 
 
98691d1
 
72b2576
98691d1
72b2576
98691d1
 
72b2576
 
 
 
98691d1
 
fc09623
fab5009
72b2576
 
98691d1
fab5009
72b2576
98691d1
 
fab5009
 
 
 
 
 
 
 
 
 
e58c122
 
 
a2b2891
64cd369
bc7194f
 
9763683
 
fab5009
d9e40cd
fab5009
b7289c6
 
 
 
 
d9e40cd
193a982
 
 
 
 
fb86b93
a2b2891
38cf0bb
 
e58c122
fded6e8
e58c122
a2b2891
 
d9e40cd
193a982
 
d9e40cd
193a982
 
fcbb419
a2b2891
fcbb419
64cd369
 
 
fab5009
 
 
 
64cd369
72b2576
64cd369
9a03021
 
 
 
 
 
0527fa6
98691d1
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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
import sys
import os

import streamlit as st
from organisations_engagees import display_organisations_engagees
from localisation import display_map
from statistiques import main as display_statistics
from ActionsRSE import display_actions_rse
from AnalyseActionsRSE import display_analyse_actions_rse
from partiesprenantes import display_materiality_partiesprenantes
from partie_prenante_carte import display_pp
from codecarbon import EmissionsTracker


# Import modifiédes fonctions liées aux scripts
from projetRSE import display_rse_projects
from labelRSE import display_rse_labels
from entreprises_labellisees import display_labelled_companies
from inspirezvous import *
from collaborons import display_company_selection_for_materiality,display_materiality_matrix
from documentations import display_documentation
from RAG_PDF_WEB import rag_pdf_web
from prompt import get_prompts_list,prompt_execution,execute_prompt
from chat_with_pps import display_chat
from high_chart import test_chart
from chat_te import display_chat_te
from empreinte_carbone import *
from comparateur import *
import base64
import pandas as pd


# Function to read and encode an SVG file to Base64
def load_svg_as_base64(file_path):
    with open(file_path, "rb") as f:
        svg_data = f.read()
    return base64.b64encode(svg_data).decode()

def main():
    
    if "emission" not in st.session_state:
        tracker = EmissionsTracker()
        tracker.start()
        st.session_state["emission"] = tracker
    
    if "partial_emissions" not in st.session_state:
        st.session_state["partial_emissions"] = {
            "Scrapping": {"cc": 0, "el": 0}, #cc for codecarbon , el for ecologits
            "extraction_pp": {"cc": 0, "el": 0},
            "cartographie": {"cc": 0, "el": 0},
            "chatbot": {"cc": 0, "el": 0},
            "download_rapport": {"cc": 0, "el": 0},
        }
 
    st.sidebar.title("OPEN DATA & IA au service de la RSE")
    section_principale = st.sidebar.radio(
        "Choisissez votre section",
        ["Data Bordeaux métropole", "Data bziiit","IA RSE","Documentation"],
        index=2
    )

    if section_principale == "Data Bordeaux métropole":
        app_mode = st.sidebar.radio(
            "Choisissez votre sous-section",
            ["Localisations", "Organisations engagées", "Statistiques", "Actions RSE", "Analyse actions RSE"]
        )
        if app_mode == "Localisations":
            display_map()
        elif app_mode == "Organisations engagées":
            display_organisations_engagees()
        elif app_mode == "Statistiques":
            display_statistics()
        elif app_mode == "Actions RSE":
            display_actions_rse()
        elif app_mode == "Analyse actions RSE":
            display_analyse_actions_rse()

  
    elif section_principale == "Data bziiit":
        ia_mode = st.sidebar.radio(
            "Choisissez votre sous-section",
            ["Labels RSE", "Entreprises labellisées", "Fiches entreprises"]
        )
        if ia_mode == "Labels RSE":
            display_rse_labels()
        elif ia_mode == "Entreprises labellisées":
            display_labelled_companies()
        elif ia_mode == "Fiches entreprises":
            data, bziiit_data = fetch_data()
            selected_company = display_company_selection(data)
            display_company_info(data, bziiit_data, selected_company)
 
    elif section_principale == "IA RSE":
        ia_mode = st.sidebar.radio(
            "Choisissez votre sous-section",
            [
                "Audit flash RSE de vos contenus",
                "Parties prenantes",
                "Chatbot Parties Prenantes",
                "Empreinte carbone détaillée",
                # "Prompts RSE - TE",
                # "Chatbot RSE - TE",
            ],
            index=1
        )

        if ia_mode == "Parties prenantes":
            # data, bziiit_data = fetch_data()
            # selected_company = display_company_selection_for_materiality(data)
            # if selected_company:
            #     display_materiality_partiesprenantes(selected_company, data, bziiit_data)
            display_pp()

        # elif ia_mode == "Matrice de matérialité":
        #     data, bziiit_data = fetch_data()
        #     selected_company = display_company_selection_for_materiality(data)
        #     if selected_company:
        #         display_materiality_matrix(selected_company, data, bziiit_data)
        
        elif ia_mode == "Chatbot Parties Prenantes":
            display_chat()
        
        elif ia_mode == "Audit flash RSE de vos contenus":
            rag_pdf_web()
        
        elif ia_mode == "Prompts RSE - TE":
            get_prompts_list()

        # elif ia_mode == "Générations de contenus RSE":
        #     st.header("Exécutez un prompt")

        #     selected_prompt = prompt_execution()
        #     if selected_prompt:
        #         execute_prompt(selected_prompt) 
        elif ia_mode == "Chatbot RSE - TE":
            display_chat_te()
        
        elif ia_mode == "Empreinte carbone détaillée":
            display_carbon_footprint()

    elif section_principale == "Documentation":
            display_documentation()

    #carbon foot_print
    st.sidebar.markdown("---")
    display_cf_comparison(st.sidebar)
    # Instructions communes à toutes les sections
    st.sidebar.markdown("---")
    st.sidebar.markdown("Powered by **bziiit IA RSE**")
    st.sidebar.markdown("2024 : Open source en Licence MIT")
    st.sidebar.markdown("info@bziiit.com")
    
if __name__ == "__main__":
    main()