Commit 5ce13979 authored by Nirmal M.D.S's avatar Nirmal M.D.S

main page

parent bc83b602
# Default ignored files
/shelf/
/workspace.xml
<component name="InspectionProjectProfileManager">
<settings>
<option name="USE_PROJECT_PROFILE" value="false" />
<version value="1.0" />
</settings>
</component>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.8 (2)" project-jdk-type="Python SDK" />
<component name="PyCharmProfessionalAdvertiser">
<option name="shown" value="true" />
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/TaskAllocation.iml" filepath="$PROJECT_DIR$/.idea/TaskAllocation.iml" />
</modules>
</component>
</project>
\ No newline at end of file
<!DOCTYPE html>
<html>
<head>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
<title>Task Prediction Form</title>
</head>
<style>
.predict-btn{
background-image: linear-gradient(310deg, #cb0c9f 0%, #98ec2d 100%);
text-transform: uppercase;
border:#cb0c9f
}
h3{
color: #cb0c9f !important:
}
.card{
background: #fff;
padding: 20px;
border-radius: 3px;
transition: transform .2s ease;
box-shadow: 0 20px 27px 0 rgba(0, 0, 0, 0.05);
border-radius: 1rem;
height: 100%;
}
</style>
<body>
<div class="container card p-5 mt-5 mb-5">
<h3 style="color: #cb0c9f;text-align:center;text-transform: uppercase;" class="mb-5 fw-bold">Task Prediction</h3>
<form id="prediction-form">
<div class="row">
<div class="col-md-4">
<label for="title">Name:</label>
</div>
<div class="col-md-8">
<input type="text" class="form-control" id="title" name="title">
</div>
</div>
<div class="row mt-4">
<div class="col-md-4">
<label for="description">Description:</label>
</div>
<div class="col-md-8">
<textarea style="height:150px" class="form-control" id="description" name="description"></textarea>
</div>
</div>
<input class="btn btn-primary predict-btn mt-5 ms-auto me-auto" type="submit" value="Predict">
<div class="fw-bold mt-5 fs-4 alert alert-warning text-center text-uppercase" id="prediction-result"></div>
</form>
</div>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.bundle.min.js" integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.9.2/dist/umd/popper.min.js" integrity="sha384-IQsoLXl5PILFhosVNubq5LC7Qb9DXgDA9i+tQ8Zj3iwWAwPtgFTxbJ8NT4GN1R8p" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.min.js" integrity="sha384-cVKIPhGWiC2Al4u+LWgxfKTRIcfu0JTxR+EQDz/bgldoEyl4H0zUF0QKbrJ0EcQF" crossorigin="anonymous"></script>
<script>
function submitDataToServer(title, description, result) {
const sql_data = {
title: title,
description: description,
level: result
};
console.log(JSON.stringify(sql_data));
fetch('http://127.0.0.1:5002/submit_data', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(sql_data)
})
.then(response => response.json())
.then(result => {
console.log(result);
})
.catch(error => {
console.error('Error:', error);
});
};
document.getElementById("prediction-form").addEventListener("submit", function(event) {
event.preventDefault();
const title = document.getElementById("title").value;
const description = document.getElementById("description").value;
let result = "";
const data = {
title: title,
task_description: description
};
fetch('http://127.0.0.1:5000/predict', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(data)
})
.then(response => response.json())
.then(result => {
const predictionResult = result.prediction;
const resultDiv = document.getElementById("prediction-result");
resultDiv.innerHTML = `Predicted task: ${predictionResult}`;
console.log(`Predicted task: ${predictionResult}`);
// Call the function to submit data to the server after receiving prediction
submitDataToServer(title, description, predictionResult);
})
.catch(error => {
console.error('Error:', error);
});
});
</script>
</body>
</html>
-- phpMyAdmin SQL Dump
-- version 5.1.1
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Sep 03, 2023 at 07:59 AM
-- Server version: 10.4.22-MariaDB
-- PHP Version: 8.1.2
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Database: `sachintha`
--
-- --------------------------------------------------------
--
-- Table structure for table `task`
--
CREATE TABLE `task` (
`id` int(100) NOT NULL,
`title` varchar(100) NOT NULL,
`description` varchar(1000) NOT NULL,
`level` varchar(20) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Indexes for dumped tables
--
--
-- Indexes for table `task`
--
ALTER TABLE `task`
ADD PRIMARY KEY (`id`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `task`
--
ALTER TABLE `task`
MODIFY `id` int(100) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
COMMIT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment