Update index.html
Browse files- index.html +98 -13
index.html
CHANGED
@@ -3,26 +3,73 @@
|
|
3 |
<head>
|
4 |
<meta charset="UTF-8">
|
5 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6 |
-
<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
|
16 |
-
<
|
17 |
</div>
|
18 |
<div class="card-body">
|
19 |
-
<div class="
|
20 |
-
<strong>
|
21 |
<p id="randomNumber" class="mt-2"></p>
|
22 |
</div>
|
23 |
-
<div class="form-group">
|
24 |
<label for="question">Posez votre question :</label>
|
25 |
-
<
|
|
|
|
|
|
|
|
|
|
|
26 |
</div>
|
27 |
<div class="text-center">
|
28 |
<button type="button" class="btn btn-primary" id="submitBtn">Obtenir la réponse</button>
|
@@ -38,6 +85,19 @@
|
|
38 |
</div>
|
39 |
</div>
|
40 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
41 |
</div>
|
42 |
|
43 |
<!-- Lien vers la bibliothèque jQuery -->
|
@@ -46,14 +106,41 @@
|
|
46 |
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/js/bootstrap.min.js"></script>
|
47 |
|
48 |
<script>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
49 |
// Fonction pour obtenir la réponse à partir de la question en utilisant l'API
|
50 |
function getAnswer(question) {
|
51 |
// Afficher l'indicateur de chargement
|
52 |
document.getElementById('loading').style.display = 'block';
|
53 |
// Masquer la réponse précédente
|
54 |
document.getElementById('answer').innerHTML = '';
|
55 |
-
|
56 |
-
fetch('https://docfile-islam.hf.space/run/predict', {
|
57 |
method: 'POST',
|
58 |
headers: {
|
59 |
'Content-Type': 'application/json'
|
@@ -75,13 +162,11 @@
|
|
75 |
document.getElementById('loading').style.display = 'none';
|
76 |
});
|
77 |
}
|
78 |
-
|
79 |
// Générer et afficher le nombre aléatoire au chargement du site
|
80 |
document.addEventListener('DOMContentLoaded', function() {
|
81 |
var randomNumber = Math.floor(Math.random() * 19) + 2;
|
82 |
document.getElementById('randomNumber').innerHTML = randomNumber;
|
83 |
});
|
84 |
-
|
85 |
// Fonction pour gérer le clic sur le bouton de soumission
|
86 |
document.getElementById('submitBtn').addEventListener('click', function() {
|
87 |
var question = document.getElementById('question').value;
|
|
|
3 |
<head>
|
4 |
<meta charset="UTF-8">
|
5 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6 |
+
<title>Chatbot Islamique</title>
|
|
|
|
|
7 |
<!-- Lien vers la bibliothèque Bootstrap -->
|
8 |
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css">
|
9 |
+
<!-- Lien vers la bibliothèque Font Awesome -->
|
10 |
+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.1/css/all.min.css">
|
11 |
+
<style>
|
12 |
+
/* ... (autres styles CSS) ... */
|
13 |
+
|
14 |
+
/* Suggestions de questions */
|
15 |
+
#suggestions {
|
16 |
+
margin-top: 20px;
|
17 |
+
}
|
18 |
+
|
19 |
+
.suggestion {
|
20 |
+
display: inline-block;
|
21 |
+
margin: 5px;
|
22 |
+
cursor: pointer;
|
23 |
+
color: #007bff;
|
24 |
+
}
|
25 |
+
|
26 |
+
/* Icône */
|
27 |
+
.icon {
|
28 |
+
font-size: 36px;
|
29 |
+
margin-right: 10px;
|
30 |
+
}
|
31 |
+
|
32 |
+
/* Mode sombre */
|
33 |
+
body.dark-mode {
|
34 |
+
background-color: #343a40;
|
35 |
+
color: white;
|
36 |
+
}
|
37 |
+
|
38 |
+
/* Animation de chargement */
|
39 |
+
.loader {
|
40 |
+
border: 4px solid #f3f3f3;
|
41 |
+
border-top: 4px solid #3498db;
|
42 |
+
border-radius: 50%;
|
43 |
+
width: 20px;
|
44 |
+
height: 20px;
|
45 |
+
animation: spin 2s linear infinite;
|
46 |
+
}
|
47 |
+
|
48 |
+
@keyframes spin {
|
49 |
+
0% { transform: rotate(0deg); }
|
50 |
+
100% { transform: rotate(360deg); }
|
51 |
+
}
|
52 |
+
</style>
|
53 |
</head>
|
54 |
<body>
|
55 |
<div class="container">
|
56 |
<div class="card mt-5">
|
57 |
+
<div class="card-header">
|
58 |
+
<span class="icon">☰</span> Chatbot Islamique
|
59 |
</div>
|
60 |
<div class="card-body">
|
61 |
+
<div class="text-center">
|
62 |
+
<strong>Connecté actuellement :</strong>
|
63 |
<p id="randomNumber" class="mt-2"></p>
|
64 |
</div>
|
65 |
+
<div class="form-group mt-4">
|
66 |
<label for="question">Posez votre question :</label>
|
67 |
+
<div class="input-group">
|
68 |
+
<textarea class="form-control" id="question" rows="3" placeholder="Entrez votre question"></textarea>
|
69 |
+
<div class="input-group-append">
|
70 |
+
<button class="btn btn-outline-secondary" type="button" id="clearBtn"><i class="fas fa-times"></i></button>
|
71 |
+
</div>
|
72 |
+
</div>
|
73 |
</div>
|
74 |
<div class="text-center">
|
75 |
<button type="button" class="btn btn-primary" id="submitBtn">Obtenir la réponse</button>
|
|
|
85 |
</div>
|
86 |
</div>
|
87 |
</div>
|
88 |
+
|
89 |
+
<div id="suggestions">
|
90 |
+
<strong>Suggestions de questions :</strong>
|
91 |
+
<div class="suggestion">Qu'est-ce que le Ramadan ?</div>
|
92 |
+
<div class="suggestion">Quelles sont les cinq prières quotidiennes ?</div>
|
93 |
+
<div class="suggestion">Quel est le livre saint de l'islam ?</div>
|
94 |
+
<!-- Ajoutez plus de suggestions ici -->
|
95 |
+
</div>
|
96 |
+
|
97 |
+
<div id="about" class="mt-5">
|
98 |
+
<h2>À Propos</h2>
|
99 |
+
<p>Cette application chatbot islamique a été créée pour répondre à vos questions sur l'islam. Posez simplement votre question dans la zone prévue et appuyez sur le bouton "Obtenir la réponse" pour obtenir une réponse.</p>
|
100 |
+
</div>
|
101 |
</div>
|
102 |
|
103 |
<!-- Lien vers la bibliothèque jQuery -->
|
|
|
106 |
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/js/bootstrap.min.js"></script>
|
107 |
|
108 |
<script>
|
109 |
+
// Fonction pour insérer une suggestion de question dans le champ de saisie
|
110 |
+
function insertSuggestion(suggestion) {
|
111 |
+
document.getElementById('question').value = suggestion;
|
112 |
+
}
|
113 |
+
|
114 |
+
// Gestion du clic sur une suggestion de question
|
115 |
+
document.addEventListener('DOMContentLoaded', function() {
|
116 |
+
const suggestions = document.querySelectorAll('.suggestion');
|
117 |
+
suggestions.forEach(suggestion => {
|
118 |
+
suggestion.addEventListener('click', function() {
|
119 |
+
const question = suggestion.innerText;
|
120 |
+
insertSuggestion(question);
|
121 |
+
});
|
122 |
+
});
|
123 |
+
});
|
124 |
+
|
125 |
+
// Gestion du clic sur le bouton de soumission
|
126 |
+
document.getElementById('submitBtn').addEventListener('click', function() {
|
127 |
+
const question = document.getElementById('question').value;
|
128 |
+
getAnswer(question);
|
129 |
+
});
|
130 |
+
|
131 |
+
// Gestion du clic sur le bouton pour effacer le contenu du champ de saisie
|
132 |
+
document.getElementById('clearBtn').addEventListener('click', function() {
|
133 |
+
document.getElementById('question').value = '';
|
134 |
+
});
|
135 |
+
|
136 |
+
// ... (autre code JavaScript)
|
137 |
// Fonction pour obtenir la réponse à partir de la question en utilisant l'API
|
138 |
function getAnswer(question) {
|
139 |
// Afficher l'indicateur de chargement
|
140 |
document.getElementById('loading').style.display = 'block';
|
141 |
// Masquer la réponse précédente
|
142 |
document.getElementById('answer').innerHTML = '';
|
143 |
+
fetch('https://docfile-my.hf.space/run/predict', {
|
|
|
144 |
method: 'POST',
|
145 |
headers: {
|
146 |
'Content-Type': 'application/json'
|
|
|
162 |
document.getElementById('loading').style.display = 'none';
|
163 |
});
|
164 |
}
|
|
|
165 |
// Générer et afficher le nombre aléatoire au chargement du site
|
166 |
document.addEventListener('DOMContentLoaded', function() {
|
167 |
var randomNumber = Math.floor(Math.random() * 19) + 2;
|
168 |
document.getElementById('randomNumber').innerHTML = randomNumber;
|
169 |
});
|
|
|
170 |
// Fonction pour gérer le clic sur le bouton de soumission
|
171 |
document.getElementById('submitBtn').addEventListener('click', function() {
|
172 |
var question = document.getElementById('question').value;
|