Spaces:
Running
Running
Upload 6 files
Browse files
.gitattributes
CHANGED
@@ -33,3 +33,5 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
36 |
+
static/uploads/chapitre[[:space:]]2[[:space:]]RECONNAISSANCE[[:space:]]DE[[:space:]]FORMES[[:space:]]ET[[:space:]]CLASSIFICATION.pdf filter=lfs diff=lfs merge=lfs -text
|
37 |
+
static/uploads/Untitled.pdf filter=lfs diff=lfs merge=lfs -text
|
static/__pycache__/main.cpython-312.pyc
ADDED
Binary file (7.41 kB). View file
|
|
static/__pycache__/main.cpython-39.pyc
ADDED
Binary file (318 Bytes). View file
|
|
static/index.html
ADDED
@@ -0,0 +1,128 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<!DOCTYPE html>
|
2 |
+
<html lang="fr">
|
3 |
+
<head>
|
4 |
+
<meta charset="UTF-8">
|
5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6 |
+
<title>Document Translator - IA Edition</title>
|
7 |
+
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet">
|
8 |
+
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
|
9 |
+
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
|
10 |
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/2.5.1/jspdf.umd.min.js"></script>
|
11 |
+
<style>
|
12 |
+
body {
|
13 |
+
background: linear-gradient(135deg, #1e3c72, #2a5298);
|
14 |
+
color: white;
|
15 |
+
text-align: center;
|
16 |
+
padding: 40px;
|
17 |
+
}
|
18 |
+
.container {
|
19 |
+
max-width: 600px;
|
20 |
+
background: rgba(255, 255, 255, 0.1);
|
21 |
+
padding: 20px;
|
22 |
+
border-radius: 15px;
|
23 |
+
backdrop-filter: blur(10px);
|
24 |
+
box-shadow: 0px 0px 15px rgba(255, 255, 255, 0.2);
|
25 |
+
}
|
26 |
+
.result-box {
|
27 |
+
background: white;
|
28 |
+
color: black;
|
29 |
+
padding: 15px;
|
30 |
+
border-radius: 10px;
|
31 |
+
text-align: left;
|
32 |
+
max-height: 300px;
|
33 |
+
overflow-y: auto;
|
34 |
+
margin-top: 15px;
|
35 |
+
font-size: 16px;
|
36 |
+
}
|
37 |
+
</style>
|
38 |
+
</head>
|
39 |
+
<body>
|
40 |
+
<div class="container">
|
41 |
+
<h1>📝 AI Document Translator</h1>
|
42 |
+
<p class="file-info">Formats supportés : <b>TXT, PDF, DOCX, PPTX, XLSX</b></p>
|
43 |
+
|
44 |
+
<form id="uploadForm">
|
45 |
+
<input type="file" id="fileInput" name="file" class="form-control mt-3" required>
|
46 |
+
|
47 |
+
<select id="src_lang" name="src_lang" class="form-control mt-3">
|
48 |
+
<option >Francais</option>
|
49 |
+
<option >Anglais</option>
|
50 |
+
<option >Arabe</option>
|
51 |
+
<option >Espagnol</option>
|
52 |
+
</select>
|
53 |
+
<select id="tgt_lang" name="tgt_lang" class="form-control mt-3">
|
54 |
+
<option >Francais</option>
|
55 |
+
<option >Anglais</option>
|
56 |
+
<option >Arabe</option>
|
57 |
+
<option >Espagnol</option>
|
58 |
+
</select>
|
59 |
+
|
60 |
+
<button type="submit" class="btn btn-success mt-3">Traduire</button>
|
61 |
+
</form>
|
62 |
+
|
63 |
+
<div class="menu mt-3">
|
64 |
+
<button type="button" class="btn btn-info" id="openFile">📂 Ouvrir le fichier</button>
|
65 |
+
<button id="copyText" class="btn btn-secondary" disabled>📋 Copier</button>
|
66 |
+
<button id="speakText" class="btn btn-dark" disabled>🔊 Écouter</button>
|
67 |
+
<button id="downloadTxt" class="btn btn-warning" disabled>⬇️ Télécharger en TXT</button>
|
68 |
+
<button id="downloadPdf" class="btn btn-danger" disabled>📄 Télécharger en PDF</button>
|
69 |
+
<button id="summarizeText" class="btn btn-primary" disabled>✂️ Résumer</button>
|
70 |
+
</div>
|
71 |
+
|
72 |
+
<h2 class="mt-4">Résultat :</h2>
|
73 |
+
<div id="result" class="result-box">Aucun texte traduit pour l’instant...</div>
|
74 |
+
</div>
|
75 |
+
|
76 |
+
<script>
|
77 |
+
$(document).ready(function() {
|
78 |
+
$('#uploadForm').submit(async function(event) {
|
79 |
+
event.preventDefault();
|
80 |
+
let formData = new FormData(this);
|
81 |
+
Swal.fire({ title: 'Traduction en cours...', didOpen: () => { Swal.showLoading(); }});
|
82 |
+
|
83 |
+
let response = await fetch('/upload/', { method: 'POST', body: formData });
|
84 |
+
let result = await response.json();
|
85 |
+
Swal.close();
|
86 |
+
if (result.translated_text) {
|
87 |
+
$('#result').html(`<b>✨ Traduction :</b><br>${result.translated_text}`);
|
88 |
+
$('#copyText, #speakText, #downloadTxt, #downloadPdf, #summarizeText').prop("disabled", false);
|
89 |
+
} else {
|
90 |
+
$('#result').html(`❌ Erreur: ${result.detail}`);
|
91 |
+
}
|
92 |
+
});
|
93 |
+
|
94 |
+
$('#speakText').click(function() {
|
95 |
+
let text = $('#result').text().trim();
|
96 |
+
if (!text) return;
|
97 |
+
let langMap = { "Francais": "fr-FR", "Anglais": "en-US", "Arabe": "ar-SA", "Espagnol": "es-ES" };
|
98 |
+
let lang = $('#tgt_lang').val();
|
99 |
+
let utterance = new SpeechSynthesisUtterance(text);
|
100 |
+
utterance.lang = langMap[lang] || "fr-FR";
|
101 |
+
utterance.rate = 1;
|
102 |
+
utterance.pitch = 1;
|
103 |
+
utterance.volume = 1;
|
104 |
+
speechSynthesis.speak(utterance);
|
105 |
+
});
|
106 |
+
|
107 |
+
$('#summarizeText').click(async function() {
|
108 |
+
let text = $('#result').text().trim();
|
109 |
+
if (!text) return;
|
110 |
+
Swal.fire({ title: 'Résumé en cours...', didOpen: () => { Swal.showLoading(); }});
|
111 |
+
|
112 |
+
let response = await fetch('/summarize/', {
|
113 |
+
method: 'POST',
|
114 |
+
headers: { 'Content-Type': 'application/json' },
|
115 |
+
body: JSON.stringify({ text: text })
|
116 |
+
});
|
117 |
+
let result = await response.json();
|
118 |
+
Swal.close();
|
119 |
+
if (result.summary) {
|
120 |
+
Swal.fire("Résumé", result.summary, "info");
|
121 |
+
} else {
|
122 |
+
Swal.fire("Erreur", "Impossible de résumer le texte.", "error");
|
123 |
+
}
|
124 |
+
});
|
125 |
+
});
|
126 |
+
</script>
|
127 |
+
</body>
|
128 |
+
</html>
|
static/uploads/TD1 (1).docx
ADDED
Binary file (53.4 kB). View file
|
|
static/uploads/Untitled.pdf
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:eb03deee8b41e265cde7eb86f14deae4cc505d9fef18a3cdaccde123f7ca6ae8
|
3 |
+
size 349803
|
static/uploads/chapitre 2 RECONNAISSANCE DE FORMES ET CLASSIFICATION.pdf
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:cad0c7e09e566f603390d90611e4fd0c969d6920a064b4cf74fdbcde58fc8c7e
|
3 |
+
size 1665388
|