Spaces:
Sleeping
Sleeping
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> | |
""" | |