File size: 1,390 Bytes
967ec2e
56d50b0
c155fff
56d50b0
 
 
c155fff
 
56d50b0
 
 
 
 
 
 
 
 
 
 
 
 
1a3e788
c155fff
 
 
56d50b0
 
 
 
 
 
 
 
c155fff
 
 
967ec2e
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<!DOCTYPE html>
<html>
<head>
    <title>Intégration API Gradio avec Bootstrap</title>
    <link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" rel="stylesheet">
    <script src="https://cdn.jsdelivr.net/npm/showdown/dist/showdown.min.js"></script>
</head>
<body>
    <div class="container mt-5">
        <div class="row">
            <div class="col-12">
                <input type="text" id="question" class="form-control" placeholder="Entrez votre question ici">
            </div>
            <div class="col-12 mt-3">
                <button onclick="getResponse()" class="btn btn-primary">Soumettre</button>
            </div>
            <div class="col-12 mt-3">
                <div id="response" class="border p-3"></div>
            </div>
        </div>
    </div>

    <script type="module">
        import { client } from "@gradio/client";

        async function getResponse() {
            const question = document.getElementById('question').value;
            const app = await client("https://docfile-gemi.hf.space/--replicas/2bkx7/");
            const result = await app.predict("/predict", [question]);
            
            const converter = new showdown.Converter();
            const html = converter.makeHtml(result.data);
            document.getElementById('response').innerHTML = html;
        }
    </script>
</body>
</html>