Minimal HTML interface
This commit is contained in:
parent
bbbea2e00b
commit
855f1bc10d
52
static/index.html
Normal file
52
static/index.html
Normal file
@ -0,0 +1,52 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Transcription et Résumé Audio</title>
|
||||
<script src="https://cdn.jsdelivr.net/npm/showdown/dist/showdown.min.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Transcription et Résumé Audio</h1>
|
||||
<form id="uploadForm">
|
||||
<input type="file" id="audioFile" accept="audio/*" required>
|
||||
<input type="submit" value="Transcrire et Résumer">
|
||||
</form>
|
||||
<div id="result"></div>
|
||||
|
||||
<script>
|
||||
document.getElementById('uploadForm').addEventListener('submit', function(e) {
|
||||
e.preventDefault();
|
||||
|
||||
var formData = new FormData();
|
||||
formData.append('file', document.getElementById('audioFile').files[0]);
|
||||
|
||||
fetch('/upload', {
|
||||
method: 'POST',
|
||||
body: formData
|
||||
})
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
if (data.task_id) {
|
||||
checkResult(data.task_id);
|
||||
}
|
||||
})
|
||||
.catch(error => console.error('Erreur:', error));
|
||||
});
|
||||
|
||||
function checkResult(taskId) {
|
||||
fetch(`/result/${taskId}`)
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
if (data.result) {
|
||||
var converter = new showdown.Converter();
|
||||
var html = converter.makeHtml(data.result);
|
||||
document.getElementById('result').innerHTML = html;
|
||||
} else {
|
||||
setTimeout(function() { checkResult(taskId); }, 2000); // Vérifier à nouveau après 2 secondes
|
||||
}
|
||||
})
|
||||
.catch(error => console.error('Erreur:', error));
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue
Block a user