Update index.html
Browse files- index.html +7 -0
index.html
CHANGED
|
@@ -13,6 +13,9 @@
|
|
| 13 |
</div>
|
| 14 |
<div class="col-12 mt-3">
|
| 15 |
<button onclick="getResponse()" class="btn btn-primary">Soumettre</button>
|
|
|
|
|
|
|
|
|
|
| 16 |
</div>
|
| 17 |
<div class="col-12 mt-3">
|
| 18 |
<div id="response" class="border p-3"></div>
|
|
@@ -24,6 +27,9 @@
|
|
| 24 |
import { client } from "@gradio/client";
|
| 25 |
|
| 26 |
async function getResponse() {
|
|
|
|
|
|
|
|
|
|
| 27 |
const question = document.getElementById('question').value;
|
| 28 |
const app = await client("https://docfile-gemi.hf.space/--replicas/2bkx7/");
|
| 29 |
const result = await app.predict("/predict", [question]);
|
|
@@ -31,6 +37,7 @@
|
|
| 31 |
const converter = new showdown.Converter();
|
| 32 |
const html = converter.makeHtml(result.data);
|
| 33 |
document.getElementById('response').innerHTML = html;
|
|
|
|
| 34 |
}
|
| 35 |
</script>
|
| 36 |
</body>
|
|
|
|
| 13 |
</div>
|
| 14 |
<div class="col-12 mt-3">
|
| 15 |
<button onclick="getResponse()" class="btn btn-primary">Soumettre</button>
|
| 16 |
+
<div id="spinner" class="spinner-border text-primary" role="status" style="display: none;">
|
| 17 |
+
<span class="sr-only">Chargement...</span>
|
| 18 |
+
</div>
|
| 19 |
</div>
|
| 20 |
<div class="col-12 mt-3">
|
| 21 |
<div id="response" class="border p-3"></div>
|
|
|
|
| 27 |
import { client } from "@gradio/client";
|
| 28 |
|
| 29 |
async function getResponse() {
|
| 30 |
+
document.getElementById('spinner').style.display = 'inline-block'; // Afficher le spinner
|
| 31 |
+
document.getElementById('response').innerHTML = ''; // Effacer la réponse précédente
|
| 32 |
+
|
| 33 |
const question = document.getElementById('question').value;
|
| 34 |
const app = await client("https://docfile-gemi.hf.space/--replicas/2bkx7/");
|
| 35 |
const result = await app.predict("/predict", [question]);
|
|
|
|
| 37 |
const converter = new showdown.Converter();
|
| 38 |
const html = converter.makeHtml(result.data);
|
| 39 |
document.getElementById('response').innerHTML = html;
|
| 40 |
+
document.getElementById('spinner').style.display = 'none'; // Masquer le spinner
|
| 41 |
}
|
| 42 |
</script>
|
| 43 |
</body>
|