File size: 15,923 Bytes
aef7e33
 
 
 
baf039a
aef7e33
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4deb54c
 
 
baf039a
 
 
 
 
 
 
 
aef7e33
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
baf039a
 
aef7e33
 
 
baf039a
aef7e33
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
baf039a
 
 
dbb882b
 
baf039a
dbb882b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
baf039a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
dbb882b
baf039a
 
 
aef7e33
 
 
 
 
 
 
 
 
 
 
 
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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
<!DOCTYPE html>
<html lang="en-US">

<head>
    <title>Pdf Categorization</title>
    <link rel="icon" href="https://cdn-icons-png.flaticon.com/512/5262/5262072.png">
    <link rel="stylesheet" href="../static/css/style2.css">
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css">
    <link rel="stylesheet" href="../static/css/vendor.bundle.base.css">


</head>

<body style="background-color: #1F2020;">
    <nav class="navbar navbar-expand-lg bg-ocr mb-5">
        <div class="container h-100">
            <!-- Logo START -->
            <a class="navbar-brand" href="pdf">
                <img class="navbar-brand-item" src="../static/icons/avignon_universite_blanc_RVB.png" alt="logo">
            </a>
            <!-- Logo END -->

            <!-- Responsive navbar toggler -->
            <button class="navbar-toggler ms-auto icon-md btn btn-light p-0 collapsed" type="button"
                data-bs-toggle="collapse" data-bs-target="#navbarCollapse" aria-controls="navbarCollapse"
                aria-expanded="false" aria-label="Toggle navigation">
                <span class="navbar-toggler-animation">
                    <span></span>
                    <span></span>
                    <span></span>
                </span>
            </button>

            <!-- Main navbar START -->
            <div class="navbar-collapse collapse" id="navbarCollapse">
                <ul class="navbar-nav navbar-nav-scroll ms-auto p-xl-0">
                    <!-- Nav item 1 Demos -->
                    <li class="nav-item nav-pills nav-pills-ocr">
                        <a class="nav-item nav-link active mb-5" href="pdf">PDF Classifier</a>
                    </li>
                    <!-- Nav item 2 Pages -->
                    <li class="nav-item nav-pills nav-pills-ocr">
                        <a class="nav-item nav-link " href="sentence">Text Classifier</a>
                    </li>
                    <li class="nav-item nav-pills nav-pills-ocr">
                        <a class="nav-item nav-link " href="voice">SLU</a>
                    </li>
                    <li class="nav-item dropdown">
                        <a class="nav-link" href="#" id="accounntMenu" data-bs-toggle="dropdown" aria-haspopup="true"
                            aria-expanded="false">language</a>
                        <ul class="dropdown-menu" aria-labelledby="accounntMenu">
                            <li> <a class="dropdown-item " href="pdf_fr"><img src="../static/icons/France.svg"
                                        class="avatar avatar" style="height: 20px;" alt="French flag"> French </a> </li>
                        </ul>
                    </li>
                </ul>
            </div>
            <!-- Main navbar END -->
        </div>
    </nav>
    <!-- Container START -->
    <main>
        <div class="row d-sm-flex justify-content-center ">
            <div class="col-lg-6 col-11 mb-lg-0 mb-5">
                <form class="" action="/pdf/upload" style="height: 88%;" id="upload-form" method="POST"
                    enctype="multipart/form-data">

                    <div class="drag-image" id="dropArea">
                        <div class="text-center ">
                            <h6 class="text-white-50 mb-3">Drag and Drop PDF here</h6>
                            <span class="text-white-50">OR</span>
                            <h6 class="text-white-50 mt-3">Click here</h6>
                            <input id="file-input" type="file" name="image" accept=".pdf" hidden>
                        </div>
                    </div>
                    <div class="d-flex justify-content-center">
                        <button class="btn me-3 btn-ocr" id="reset" type="button" onclick="deleteCurrentFile()"> <i
                                class="bi bi-pencil-fill pe-1"></i> Clear </button>
                        <button type="submit" class="btn ms-3 btn-ocr">Submit</button>
                    </div>
                </form>
            </div>
            <!-- la categorie la plus dominante-->
            <div class="col-lg-5  col-xl-5 col-11 mt-5 mt-lg-0">
                <div class="card" style="background-color: #303131; border: 2px dashed rgb(82, 82, 82);">
                    <div class="card-body text-center" id="static">
                        <div class="col-12 d-flex justify-content-center">
                            <div class="col-sm-12 d-inline align-items-center" style="height: 175px; width: 229px;">
                                <div class="flex-shrink-0 avatar avatar-lg  me-2 mb-3 mt-4">
                                    <img class="avatar-img rounded-circle" src="../static/icons/logo_header_128x128.png"
                                        alt="">
                                </div>
                                <h5 class="card-title text-white-50">Get more insights about your pdf πŸ“‘πŸ“‘.</h5>
                            </div>

                        </div>
                    </div>
                    <div class="card-body d-none" id="dynamic">
                        <h4 class="card-title text-white">Text's Category</h4>
                        <div class="row d-flex">
                            <div class="col-sm-7 col-6">
                                <ul class="graphl-legend-rectangle" id="class-probabilities">
                                    {% for class_label, probability in class_probabilities.items() %}
                                    {% if loop.index <= 5 %} <li class="text-white-50">
                                        <span class="bg-{{ class_label[1] }}"></span>
                                        <div class="d-flex justify-content-center">
                                            {{ class_label[0] }}:
                                            <span class="text-white w-100">&nbsp;{{ "%.2f" % probability }}%</span>
                                        </div>
                                        </li>
                                        {% endif %}
                                        {% endfor %}
                                </ul>
                            </div>
                            <div class="col-sm-5 grid-margin col-6">
                                <canvas class="bestSellers" data-chart='{{ chart_data | tojson | safe }}'
                                    id="bestSellers#"></canvas>
                            </div>
                        </div>
                        <div class="mb-lg-0 text-white-50">
                            la classe la plus dominante est <span class="fw-bolder text-white" id="predicted-class">{{
                                predicted_class[0]
                                }}</span>
                        </div>
                    </div>
                </div>
                <!-- <div class="">
                    <textarea id="category-result" readonly>{{predicted_class}}</textarea>
                </div> -->

                <div class="result mt-3">
                    <h6 class="text-start">Extracted Text</h6>
                    <textarea id="ocr-result" readonly>{{extracted_text}}</textarea>
                    <button id="copy-btn" class="btn btn-ocr">Copy</button>
                </div>

                <!-- Right sidebar END -->
            </div> <!-- Row END -->

        </div>
        <div class="row d-sm-flex justify-content-center mb-5">
            <div class="col-11 d-none" id="dynamicResult">
                <div class="row " >
                    <h1 id="resultsHeading" class="text-center text-white-50">Results</h1>
                    <div class="col-4 " >
                        <div class="nav flex-column position-sticky top-10 shadow-lg"
                            style="background-color: #222424;">
                            <div class="card" style="background-color: #303131; border: 2px dashed rgb(82, 82, 82);">
                                <div class="card-body ">
                                    <h4 class="card-title text-white">Text's Category</h4>
                                    <div class="row d-flex">
                                        <div class="col-sm-7 col-6">
                                            <ul class="graphl-legend-rectangle" id="class-probabilities-result-section">
                                                {% for class_label, probability in class_probabilities.items() %}
                                                {% if loop.index <= 5 %} <li class="text-white-50">
                                                    <span class="bg-{{ class_label[1] }}"></span>
                                                    <div class="d-flex justify-content-center">
                                                        {{ class_label[0] }}:
                                                        <span class="text-white w-100">&nbsp;{{ "%.2f" % probability
                                                            }}%</span>
                                                    </div>
                                                    </li>
                                                    {% endif %}
                                                    {% endfor %}
                                            </ul>
                                        </div>
                                        <div class="col-sm-5 grid-margin col-6">
                                            <canvas class="bestSellers" data-chart='{{ chart_data | tojson | safe }}'
                                                id="bestSellers#"></canvas>
                                        </div>
                                    </div>
                                    <div class="mb-lg-0 text-white-50">
                                        la classe la plus dominante est <span class="fw-bolder text-white"
                                            id="predicted-class-result-section">{{
                                            predicted_class[0]
                                            }}</span>
                                    </div>
                                </div>
                            </div>

                            <div class="card my-auto mt-3"
                                style="background-color: #303131; border: 2px dashed rgb(82, 82, 82);">
                                <div class="card-body">
                                    <h4 class="card-title text-white">Legend</h4>
                                    <div class="row d-flex">
                                        <div class="col-sm-6 col-6">
                                            <ul class="graphl-legend-rectangle">
                                                <li class="text-white-50"><span class="bg-info "></span>vehicles
                                                </li>
                                                <li class="text-white-50"><span class="bg-success"></span>environments
                                                </li>
                                                <li class="text-white-50"><span class="bg-danger"></span>energies
                                                </li>
                                                <li class="text-white-50"><span class="bg-primary"></span>Physics
                                                </li>
                                                <li class="text-white-50"><span class="bg-moss"></span>robotics
                                                </li>
                                                <li class="text-white-50"><span class="bg-agri"></span>agriculture
                                                </li>
                                                <li class="text-white-50"><span class="bg-yellow"></span>ML
                                                </li>
                                                <li class="text-white-50"><span class="bg-warning"></span>economies
                                                </li>
                                                <li class="text-white-50"><span class="bg-vanila"></span>technologies
                                                </li>
                                            </ul>
                                        </div>
                                        <div class="col-sm-6 col-6">
                                            <ul class="graphl-legend-rectangle">

                                                <li class="text-white-50"><span class="bg-coffe"></span>mathematics
                                                </li>
                                                <li class="text-white-50"><span class="bg-orange "></span>sports
                                                </li>
                                                <li class="text-white-50"><span class="bg-cyan"></span>AI
                                                </li>
                                                <li class="text-white-50"><span class="bg-rosy"></span>Innovation
                                                </li>
                                                <li class="text-white-50"><span class="bg-picton"></span>Science
                                                </li>
                                                <li class="text-white-50"><span class="bg-purple"></span>Societies
                                                </li>
                                                <li class="text-white-50"><span class="bg-pink"></span>administration
                                                </li>
                                                <li class="text-white-50"><span class="bg-cambridge"></span>biology
                                                </li>
                                            </ul>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>

                    </div>
                    <div class="col-8">
                        <div class="card " style="background-color: #303131; border: 2px dashed rgb(82, 82, 82);">
                            <div class="card-body">
                                <h5 class="card-title text-white mb-3">Transcribed and Classified Text</h5>
                                <div id="transcribedText" class="text-white-50 mb-4"></div>
                                <div class="text-center">
                                    <div class="col-12 d-flex justify-content-center">
                                        <div class="col-sm-12 d-inline align-items-center" id="classifiedText">
                                            {% if sentences_prediction %}
                                            {% for sentence, color in sentences_prediction.items() %}
                                            <span class="text-bold text-start bg-{{color[1]}}">
                                                {{sentence}}
                                            </span>
                                            {% endfor %}
                                            {% endif %}
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>

                </div>
            </div>

        </div>
    </main>

    <!-- Container END -->
    <script id="dashboard-pdf-script" src="../static/js/dashboard_pdf.js"></script>
    <script src="../static/js/Chart.min.js"></script>
    <script src="../static/js/pdf.js" type="text/javascript"></script>
    <script src="../static/js/vendor.bundle.base.js"></script>

</body>

</html>