File size: 1,958 Bytes
da5916b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
css="""<style>
    body {
        font-family: 'Arial', sans-serif;
        background-color: #f0f0f0;
        margin: 0;
        padding: 0;
    }

    #banner {
        background-color: #ff4500;
        color: white;
        padding: 10px;
        text-align: center;
        font-size: 24px;
    }

    #form-container {
        margin: 50px auto;
        padding: 20px;
        background-color: #ffffff;
        border-radius: 8px;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    }

    input[type="text"] {
        width: 100%;
        padding: 10px;
        margin-bottom: 10px;
        border: 1px solid #ccc;
        border-radius: 4px;
        box-sizing: border-box;
    }

    button {
        background-color: #4caf50;
        color: white;
        padding: 10px 15px;
        border: none;
        border-radius: 4px;
        cursor: pointer;
        font-size: 16px;
    }

    #output {
        margin-top: 20px;
        padding: 10px;
        background-color: #f8f8f8;
        border: 1px solid #ddd;
        border-radius: 4px;
    }
</style>
"""
bot_template = """
<div id="banner">
    Red Octopus
</div>

<div id="form-container">
    <form id="input_form">
        <label for="input_text">Enter your text:</label>
        <input type="text" id="input_text" name="input_text" required>
        <br>
        <button type="button" onclick="submitForm()">Submit</button>
    </form>
</div>

<div id="output"></div>

<script>
    function submitForm() {
        var inputText = document.getElementById('input_text').value;
        fetch('/predict', {
            method: 'POST',
            headers: {
                'Content-Type': 'application/json',
            },
            body: JSON.stringify({ text: inputText }),
        })
        .then(response => response.json())
        .then(data => {
            document.getElementById('output').innerText = 'Model Prediction: ' + data.prediction;
        });
    }
</script>
"""