Docfile commited on
Commit
56ea875
·
1 Parent(s): 0b893cf

Upload 2 files

Browse files
Files changed (2) hide show
  1. index.html +82 -0
  2. styles.css +16 -0
index.html ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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>Application juridique</title>
7
+ <!-- Lien vers le fichier CSS personnalisé -->
8
+ <link rel="stylesheet" href="styles.css">
9
+ <!-- Lien vers la bibliothèque Bootstrap -->
10
+ <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css">
11
+ </head>
12
+ <body>
13
+ <div class="container">
14
+ <div class="card mt-5">
15
+ <div class="card-header bg-primary text-white">
16
+ <h1 class="text-center">Application juridique</h1>
17
+ </div>
18
+ <div class="card-body">
19
+ <div class="form-group">
20
+ <label for="question">Posez votre question :</label>
21
+ <textarea class="form-control" id="question" rows="3" placeholder="Entrez votre question"></textarea>
22
+ </div>
23
+ <div class="text-center">
24
+ <button type="button" class="btn btn-primary" id="submitBtn">Obtenir la réponse</button>
25
+ </div>
26
+ <div id="loading" class="text-center mt-4" style="display: none;">
27
+ <div class="spinner-border text-primary" role="status">
28
+ <span class="sr-only">Chargement...</span>
29
+ </div>
30
+ </div>
31
+ <div class="mt-4 text-center">
32
+ <strong>Réponse :</strong>
33
+ <p id="answer" class="mt-2"></p>
34
+ </div>
35
+ </div>
36
+ </div>
37
+ </div>
38
+
39
+ <!-- Lien vers la bibliothèque jQuery -->
40
+ <script src="https://code.jquery.com/jquery-3.5.1.slim.min.js"></script>
41
+ <!-- Lien vers la bibliothèque Bootstrap JavaScript -->
42
+ <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/js/bootstrap.min.js"></script>
43
+
44
+ <script>
45
+ // Fonction pour gérer le clic sur le bouton de soumission
46
+ document.getElementById('submitBtn').addEventListener('click', function() {
47
+ var question = document.getElementById('question').value;
48
+ getAnswer(question);
49
+ });
50
+
51
+ // Fonction pour obtenir la réponse à partir de la question en utilisant l'API
52
+ function getAnswer(question) {
53
+ // Afficher l'indicateur de chargement
54
+ document.getElementById('loading').style.display = 'block';
55
+ // Masquer la réponse précédente
56
+ document.getElementById('answer').innerHTML = '';
57
+
58
+ fetch('https://docfile-islam.hf.space/run/predict', {
59
+ method: 'POST',
60
+ headers: {
61
+ 'Content-Type': 'application/json'
62
+ },
63
+ body: JSON.stringify({
64
+ data: [question]
65
+ })
66
+ })
67
+ .then(response => response.json())
68
+ .then(data => {
69
+ var answer = data.data[0];
70
+ document.getElementById('answer').innerHTML = answer;
71
+ })
72
+ .catch(error => {
73
+ console.error('Une erreur s\'est produite:', error);
74
+ })
75
+ .finally(() => {
76
+ // Masquer l'indicateur de chargement après avoir reçu la réponse
77
+ document.getElementById('loading').style.display = 'none';
78
+ });
79
+ }
80
+ </script>
81
+ </body>
82
+ </html>
styles.css ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .card {
2
+ max-width: 400px;
3
+ margin: 0 auto;
4
+ }
5
+
6
+ .card-header {
7
+ font-size: 24px;
8
+ }
9
+
10
+ .btn-primary {
11
+ width: 100%;
12
+ }
13
+
14
+ #answer {
15
+ font-weight: bold;
16
+ }