jaynopponep's picture
fixing app.py
7ba9378
raw
history blame
3.11 kB
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>AI Detector</title>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
<style>
body, html {
height: 100%;
margin: 0;
}
.bg {
background-image: url('your-background-image.jpg'); /* Replace with your image URL */
height: 100%;
background-position: center;
background-repeat: no-repeat;
background-size: cover;
}
.container {
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
text-align: center;
}
.title {
font-size: 3em; /* Makes the title larger */
}
.submit-btn {
font-size: 1.2em; /* Makes the button text larger */
padding: 10px 24px; /* Larger button padding */
}
.auto-expand {
overflow-y: hidden;
resize: none; /* Prevents resizing manually */
min-height: 50px; /* Minimum height */
}
</style>
</head>
<body>
<div class="bg">
<div class="container">
<h1 class="title">AI Detector</h1>
<form id="aiForm">
<div class="form-group">
<label for="inputData">Baljinder and Jay for ICCAE</label>
<textarea class="form-control auto-expand" id="inputData" placeholder="Enter data"></textarea>
</div>
<button type="submit" class="btn btn-primary submit-btn">Submit</button>
</form>
<p id="result" class="lead"></p>
</div>
</div>
<!-- Load jQuery from CDN -->
<script src="https://code.jquery.com/jquery-3.5.1.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.5.2/dist/js/bootstrap.bundle.min.js"></script>
<script>
// Function to resize textarea based on content
function resizeTextarea (id) {
const textarea = document.getElementById(id);
textarea.style.height = 'auto';
textarea.style.height = (textarea.scrollHeight) + 'px';
}
// Initial resize
resizeTextarea('inputData');
// Resize on input
$('#inputData').on('input', function () {
resizeTextarea('inputData');
});
$('#aiForm').submit(function(event) {
event.preventDefault();
var inputText = $('#inputData').val();
// AJAX call to send data to server
$.ajax({
type: "POST",
url: "/", // Assuming your Flask route is '/'
contentType: "application/json;charset=UTF-8",
data: JSON.stringify({text: inputText}),
success: function(response) {
// Display the result
$('#result').text('Classified as: ' + response.classification);
},
error: function(error) {
console.log(error);
}
});
});
</script>
</body>
</html>