File size: 1,882 Bytes
6070887
 
 
 
 
 
 
 
 
 
 
3ebd5b5
6070887
3ebd5b5
6070887
 
 
 
 
 
 
 
 
3ebd5b5
6070887
 
 
 
 
3ebd5b5
 
 
6070887
 
 
3ebd5b5
6070887
 
 
 
3ebd5b5
 
 
 
6070887
 
 
 
3ebd5b5
6070887
3ebd5b5
6070887
 
 
3ebd5b5
6070887
 
3ebd5b5
6070887
 
 
 
 
 
3ebd5b5
6070887
3ebd5b5
6070887
3ebd5b5
6070887
3ebd5b5
6070887
 
 
 
3ebd5b5
6070887
 
 
 
 
3ebd5b5
6070887
 
 
3ebd5b5
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
import streamlit as st
import pandas as pd
import plotly.express as px

from pdf_parser import extract_text
from esg_metrics import extract_scope, extract_revenue, carbon_intensity
from vector_store import index_doc
from hyperrag import build_graph
from analysis import answer
from discourse_graph import add_claim, detect_greenwashing

st.set_page_config(layout="wide")

st.title("๐ŸŒฑ ESG HyperRAG Analyzer")

st.sidebar.header("Upload ESG Report")

file = st.sidebar.file_uploader("Upload ESG PDF", type=["pdf"])

company = st.sidebar.text_input("Company")

sector = st.sidebar.text_input("Sector")

if st.sidebar.button("Analyze"):

    if file and company and sector:

        text = extract_text(file)

        s1 = extract_scope(text,1)
        s2 = extract_scope(text,2)
        s3 = extract_scope(text,3)

        revenue = extract_revenue(text)

        intensity = carbon_intensity(s1,revenue)

        index_doc(text,{
            "company":company,
            "sector":sector,
            "scope1":s1,
            "scope2":s2,
            "scope3":s3,
            "intensity":intensity
        })

        build_graph([text])

        add_claim(company,"low emissions",f"Scope1 {s1}")

        st.success("Report processed")

        df = pd.DataFrame({
            "Scope":["Scope1","Scope2","Scope3"],
            "Value":[s1,s2,s3]
        })

        fig = px.bar(df,x="Scope",y="Value",color="Scope")

        st.plotly_chart(fig,use_container_width=True)

        st.metric("Carbon Intensity", intensity)


st.header("๐Ÿ”Ž HyperRAG Query")

q = st.text_input("Ask ESG question")

if st.button("Search"):

    st.text(answer(q))


st.header("๐Ÿšจ Greenwashing Detection")

if st.button("Check"):

    issues = detect_greenwashing()

    if issues:

        st.error(f"Potential contradictions: {issues}")

    else:

        st.success("No greenwashing detected")