Skip to content
Snippets Groups Projects
Commit fac28e8d authored by Iskandar, Michelle P (UG - Computer Science)'s avatar Iskandar, Michelle P (UG - Computer Science) :ice_skate:
Browse files

Added db front end

parent 5b37132a
No related branches found
No related tags found
1 merge request!5Database
Pipeline #31269 failed
...@@ -52,6 +52,8 @@ app.post('/predict', (req,res) => { ...@@ -52,6 +52,8 @@ app.post('/predict', (req,res) => {
// Insert the record to the collection, throw error if insert unsuccessful // Insert the record to the collection, throw error if insert unsuccessful
collection.insert(rec, {w:1}, function(err, result) {}); collection.insert(rec, {w:1}, function(err, result) {});
}, function(){
db.close();
}); });
res.render('predictions',{predictions:JSON.parse(JSON.parse(body).predictionText)}) res.render('predictions',{predictions:JSON.parse(JSON.parse(body).predictionText)})
...@@ -61,9 +63,21 @@ app.post('/predict', (req,res) => { ...@@ -61,9 +63,21 @@ app.post('/predict', (req,res) => {
console.log(req.body.plot) console.log(req.body.plot)
// res.render('index', {}); // res.render('index', {});
}); });
app.get('/submissions', function (req, res) {
var resultArray = [];
/**MongoClient.connect(url, function(err, database) {
if(err) { return console.dir(err); }
var cursor = database.db().collection('Pred_Records').find()
cursor.forEach(function(doc, err){
resultArray.push(doc)
}, function(){
db.close();
res.render('submissions', {items: resultArray});
});
});**/
res.render('submissions', {});
});
\ No newline at end of file
...@@ -71,7 +71,8 @@ fieldset { ...@@ -71,7 +71,8 @@ fieldset {
-ms-transition: all 0.1s ease-in-out; -ms-transition: all 0.1s ease-in-out;
-o-transition: all 0.1s ease-in-out; -o-transition: all 0.1s ease-in-out;
transition: all 0.1s ease-in-out; transition: all 0.1s ease-in-out;
color: black; color: #444;
margin-top: 4%;
} }
.ghost-button:hover { .ghost-button:hover {
border:2px solid #e95e01; border:2px solid #e95e01;
...@@ -86,7 +87,6 @@ p { ...@@ -86,7 +87,6 @@ p {
width: 100%; width: 100%;
height: 100%; height: 100%;
color: white; color: white;
display: grid;
background-size: 300% 300%; background-size: 300% 300%;
/* background-image: linear-gradient( /* background-image: linear-gradient(
-90deg, -90deg,
...@@ -132,4 +132,45 @@ p { ...@@ -132,4 +132,45 @@ p {
border-color: #007299; border-color: #007299;
color: #007299; color: #007299;
box-shadow: none; box-shadow: none;
}
/* Add a black background color to the top navigation */
.topnav {
background-color: cornflowerblue;
overflow: hidden;
}
/* Style the links inside the navigation bar */
.topnav a {
float: left;
color: #f2f2f2;
text-align: center;
padding: 14px 16px;
text-decoration: none;
font-size: 1.3em;
font-family: Calibri, 'Trebuchet MS', sans-serif;
font-weight: bold;
}
/* Change the color of links on hover */
.topnav a:hover {
background-color: #ddd;
color: #e95e01;
}
/* Add a color to the active/current link */
.topnav a.active {
background-color: #e95e01;
color: white;
}
.title{
color: cornflowerblue;
font-size: 2.2em;
margin-top: 5%;
}
.subtitle{
color: #e95e01;
font-size: 1.2em;
} }
\ No newline at end of file
...@@ -13,10 +13,14 @@ ...@@ -13,10 +13,14 @@
</head> </head>
<div class="bg"> <div class="bg">
<div class="topnav">
<a class="active" href="/">NLP11</a>
<a href="/submissions">Submissions</a>
</div>
<body class="text-center" > <body class="text-center" >
<div class="row"> <div class="row">
<h1 style="color: cornflowerblue;">NLP Group 11: Predict movie genres by plot</h1> <h1 class="title">NLP Group 11: Predict movie genres by plot</h1>
<b style="color: #e95e01; font-size: large;">Enter a movie plot text to receive a prediction of the grenre(s)</b> <br> <b class="subtitle">Enter a movie plot text to receive a prediction of the grenre(s)</b> <br>
<!-- <h2>Enter plot text</h2> --> <!-- <h2>Enter plot text</h2> -->
<!-- <div>Any Address holding a balance of SIMP is able allow the backend to burn their tokens. <b>MAKE SURE METAMASK BROWSER EXTENSION IS CONNECTED TO THE WEBSITE (TOP RIGHT)</b></div> --> <!-- <div>Any Address holding a balance of SIMP is able allow the backend to burn their tokens. <b>MAKE SURE METAMASK BROWSER EXTENSION IS CONNECTED TO THE WEBSITE (TOP RIGHT)</b></div> -->
......
...@@ -15,6 +15,10 @@ ...@@ -15,6 +15,10 @@
</head> </head>
<div class="bg"> <div class="bg">
<div class="topnav">
<a href="/">NLP11</a>
<a href="/submissions">Submissions</a>
</div>
<body class="text-center" > <body class="text-center" >
<div class="row"> <div class="row">
<h1 style="color: cornflowerblue;">Predicted Genres</h1> <h1 style="color: cornflowerblue;">Predicted Genres</h1>
......
<!DOCTYPE html>
<html>
<head>
<title>NLP Demo</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" type="text/css" href="/css/style.css">
<link href='https://fonts.googleapis.com/css?family=Open+Sans:300' rel='stylesheet' type='text/css'>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css">
<!-- jQuery library -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
</head>
<div class="bg">
<div class="topnav">
<a href="/">NLP11</a>
<a class="active" href="/submissions">Submissions</a>
</div>
<body class="text-center" >
</body>
</div>
</html>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment