Update index.html
Browse files- index.html +11 -6
index.html
CHANGED
|
@@ -27,18 +27,23 @@
|
|
| 27 |
import { client } from "@gradio/client";
|
| 28 |
|
| 29 |
async function getResponse() {
|
| 30 |
-
document.getElementById('spinner')
|
| 31 |
-
document.getElementById('response')
|
|
|
|
|
|
|
|
|
|
|
|
|
| 32 |
|
| 33 |
const question = document.getElementById('question').value;
|
| 34 |
const app = await client("https://docfile-gemi.hf.space/--replicas/p1sej/");
|
| 35 |
-
|
| 36 |
const result = await app.predict("/predict", [question]);
|
| 37 |
-
|
| 38 |
const converter = new showdown.Converter();
|
| 39 |
const html = converter.makeHtml(result.data);
|
| 40 |
-
|
| 41 |
-
|
|
|
|
|
|
|
| 42 |
}
|
| 43 |
</script>
|
| 44 |
</body>
|
|
|
|
| 27 |
import { client } from "@gradio/client";
|
| 28 |
|
| 29 |
async function getResponse() {
|
| 30 |
+
const spinner = document.getElementById('spinner');
|
| 31 |
+
const responseDiv = document.getElementById('response');
|
| 32 |
+
|
| 33 |
+
// Afficher le spinner et effacer la réponse précédente
|
| 34 |
+
spinner.style.display = 'inline-block';
|
| 35 |
+
responseDiv.innerHTML = '';
|
| 36 |
|
| 37 |
const question = document.getElementById('question').value;
|
| 38 |
const app = await client("https://docfile-gemi.hf.space/--replicas/p1sej/");
|
|
|
|
| 39 |
const result = await app.predict("/predict", [question]);
|
| 40 |
+
|
| 41 |
const converter = new showdown.Converter();
|
| 42 |
const html = converter.makeHtml(result.data);
|
| 43 |
+
|
| 44 |
+
// Mettre à jour la réponse et masquer le spinner
|
| 45 |
+
responseDiv.innerHTML = html;
|
| 46 |
+
spinner.style.display = 'none';
|
| 47 |
}
|
| 48 |
</script>
|
| 49 |
</body>
|