Commit 56f14ca5 authored by Navoda Gunasekera's avatar Navoda Gunasekera

add extra .py file

parents 43ac4dad a51052bb
{
"cells": [],
"metadata": {},
"nbformat": 4,
"nbformat_minor": 5
}
This diff is collapsed.
This diff is collapsed.
......@@ -10,3 +10,37 @@ Some travelers do not know much about trains and attractive destinations to choo
Passengers cannot get information about train stopping station, facilities, and the time duration of the trip. Railway passengers cannot get the needful and exact information about their visiting places.
When passengers booking the ticket they cannot be booked which seat they want and there is no process to suggest the most preferred seating place. It may cause personal conflicts between closely seated passengers due to differences of personal interest.
Difficult to find the visitor's attracted places that are located near the trip route. Therefore unpopular attractions are missed by many travelers. It is affected by traveling passengers and the tourism industry.
**Individual research question**
***IT18500790***
Some travelers do not know much about trains and attractive destinations to choose from. At present, there is no application to guide tourists to the tourist destinations of their choice. Therefore passenger needs to spend more time for find the visiting places. It may cause them to waste their time which can spend on their enjoyment.
***IT18085822***
Passengers cannot get information about train stopping station, facilities, and the time duration of the trip. Railway passengers cannot get the needful and exact information about their visiting places.
***IT18001280***
Providing a facility to view available seats and suggest the most suitable seating place for a particular passenger. Providing the selection facility to choosing the seating place according to their choice.
***IT18148282***
Suggest the best visiting places according to the passenger's personal trip plan. Providing the most suitable visiting places suggestions by using passenger's relevant information.
**Individual Objectives**
***IT18500790***
Providing the most suitable train plan to the passenger according to their needs by using a machine learning algorithm.
***IT18085822***
Machine learning-based chat-bot app to interact with the user 24 X 7, providing relevant information like train facilities, place information which suggest by trip schedule, etc. to the users according to the user queries.
***IT18001280***
Sequentially predict the most suitable seat for the passenger by using a machine learning algorithm.
***IT18148282***
Suggest the best places to visit for the passenger using a machine learning algorithm by gathering relevant data from the railway passengers.
**Solution**
Passengers can select their train schedule for traveling. But sometimes they miss out on places of their choice. This situation can reduce if predicting the trip schedule they want.
Presently passenger wants to find some information about the particular train and system solves that issue by introducing a new machine learning-based chat-bot app for the users. Users can get information about a specific location by using the chat-bot application.
Providing a facility to view available seats and suggest the most suitable seating place for a particular passenger. Providing the selection facility to choosing the seating place according to their choice.
Suggest the best visiting places according to the passenger's personal trip plan. Providing the most suitable visiting places suggestions by using passenger's relevant information.
This diff is collapsed.
This diff is collapsed.
from flask import Flask
app = Flask(__name__)
import random
import json
import torch
from model import NeuralNet
from nltk_utils import bag_of_words, tokenize
@app.route('/<string:name>/')
def hello(name):
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
with open('intents.json', 'r') as json_data:
intents = json.load(json_data)
FILE = "data.pth"
data = torch.load(FILE)
input_size = data["input_size"]
hidden_size = data["hidden_size"]
output_size = data["output_size"]
all_words = data['all_words']
tags = data['tags']
model_state = data["model_state"]
model = NeuralNet(input_size, hidden_size, output_size).to(device)
model.load_state_dict(model_state)
model.eval()
bot_name = "TravellChatty"
while True:
# sentence = "do you use credit cards?"
sentence =name
if sentence == "quit":
break
sentence = tokenize(sentence)
X = bag_of_words(sentence, all_words)
X = X.reshape(1, X.shape[0])
X = torch.from_numpy(X).to(device)
output = model(X)
_, predicted = torch.max(output, dim=1)
tag = tags[predicted.item()]
probs = torch.softmax(output, dim=1)
prob = probs[0][predicted.item()]
if prob.item() > 0.75:
for intent in intents['intents']:
if tag == intent["tag"]:
return (f" {random.choice(intent['responses'])}")
#print(f"{bot_name}: {random.choice(intent['responses'])}")
else:
return (f" I do not understand...")
#print(f"{bot_name}: I do not understand...")
app.run()
import random
import json
import torch
#import torch library
from model import NeuralNet
from nltk_utils import bag_of_words, tokenize
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
with open('intents.json', 'r') as json_data:
intents = json.load(json_data)
FILE = "data.pth"
data = torch.load(FILE)
input_size = data["input_size"]
hidden_size = data["hidden_size"]
output_size = data["output_size"]
all_words = data['all_words']
tags = data['tags']
model_state = data["model_state"]
model = NeuralNet(input_size, hidden_size, output_size).to(device)
model.load_state_dict(model_state)
model.eval()
bot_name = "TravellChatty"
print("Let's chat! (type 'quit' to exit)")
while True:
# sentence = "do you use credit cards?"
sentence = input("You: ")
if sentence == "quit":
break
sentence = tokenize(sentence)
X = bag_of_words(sentence, all_words)
X = X.reshape(1, X.shape[0])
X = torch.from_numpy(X).to(device)
output = model(X)
_, predicted = torch.max(output, dim=1)
tag = tags[predicted.item()]
probs = torch.softmax(output, dim=1)
prob = probs[0][predicted.item()]
if prob.item() > 0.75:
for intent in intents['intents']:
if tag == intent["tag"]:
print(f"{bot_name}: {random.choice(intent['responses'])}")
else:
print(f"{bot_name}: I do not understand...")
<div class="x_copyr_main_wrapper float_left" style="margin-top:5%;">
<button onclick="topFunction()" id="myBtn" title="Go to top"> <i class="fa fa-arrow-up"></i></button>
<button onclick="naviFunction();" id="myBtnPlan" title="Create Plan" > <i class="fa fa-calendar"></i> </button>
<button onclick="showChat(); minimizeChat();" id="myBtnChat" title="Chatbot" > <i class="fa fa-envelope"></i> </button>
<div class="container">
<p>Copyright © 2021 SLIIT (Research Project). All rights reserved.</p>
<a href="edit_place.php">aa</a>
</div>
</div>
\ No newline at end of file
<!-- preloader Start -->
<div id="preloader">
<div id="status">
<img src="images/loader.gif" id="preloader_image" alt="loader" style="width: 150px;">
</div>
</div>
<div class="serach-header">
<div class="searchbox">
<button class="close">×</button>
<form>
<input type="search" placeholder="Search …">
<button type="submit"><i class="fa fa-search"></i>
</button>
</form>
</div>
</div>
<!-- x top header_wrapper End -->
<div class="x_top_header_wrapper float_left">
<div class="container">
<div class="x_top_header_left_side_wrapper float_left">
<p>R A I L W A Y T O U R</p>
</div>
<div class="x_top_header_right_side_wrapper float_left">
<div class="x_top_header_social_icon_wrapper">
<ul>
</ul>
</div>
<div class="x_top_header_all_select_box_wrapper">
<ul>
</ul>
</div>
</div>
</div>
</div>
<!-- hs Navigation Start -->
<div class="hs_navigation_header_wrapper">
<div class="container">
<div class="row">
<div class=" col-xl-3 col-lg-3 col-md-3 col-sm-12 col-12">
<div class="hs_logo_wrapper d-none d-sm-none d-xs-none d-md-block">
<a href="javascript:void(0)" onclick="naviHome()">
<img src="images/RailwayTour.png" style="height: 70px; padding-bottom: 10%;" class="img-responsive" alt="logo" title="Logo" />
</a>
</div>
</div>
<div class="col-xl-9 col-lg-9 col-md-9 col-sm-12 col-12">
<div class="hs_navi_cart_wrapper d-none d-sm-none d-xs-none d-md-block d-lg-block d-xl-block">
<div class="dropdown-wrapper menu-button menu_button_end"> <a class="menu-button" href="#" style="padding: 17px;"></a>
<div class="drop-menu">
<div class="cc_cart_wrapper1">
<div class="cc_cart_img_wrapper">
<img src="images/cart_img.jpg" alt="cart_img" />
</div>
<div class="cc_cart_cont_wrapper">
<h4><a href="#">Car</a></h4>
<p>Quantity : 2 × $45</p>
<h5>$90</h5>
<button type="button" class="close" data-dismiss="modal">&times;</button>
</div>
</div>
<div class="cc_cart_wrapper1 cc_cart_wrapper2">
<div class="cc_cart_img_wrapper">
<img src="images/cart_img.jpg" alt="cart_img" />
</div>
<div class="cc_cart_cont_wrapper">
<h4><a href="#">Car</a></h4>
<p>Quantity : 2 × $45</p>
<h5>$90</h5>
<button type="button" class="close" data-dismiss="modal">&times;</button>
</div>
</div>
<div class="cc_cart_wrapper1">
<div class="cc_cart_img_wrapper">
<img src="images/cart_img.jpg" alt="cart_img" />
</div>
<div class="cc_cart_cont_wrapper">
<h4><a href="#">Car</a></h4>
<p>Quantity : 2 × $45</p>
<h5>$90</h5>
<button type="button" class="close" data-dismiss="modal">&times;</button>
</div>
<div class="checkout_btn_resto"> <a href="car_checkout.html">Checkout</a>
</div>
</div>
</div>
</div>
</div>
<nav class="hs_main_menu d-none d-sm-none d-xs-none d-md-block">
<ul>
<li>
<a class="menu-button single_menu" href="javascript:void(0)" onclick="naviHome()">Home</a>
</li>
<li>
<a class="menu-button single_menu" href="javascript:void(0)" onclick="naviFunction();">Trip Plan</a>
</li>
<li>
<a class="menu-button single_menu" href="javascript:void(0)" >About</a>
</li>
</ul>
</nav>
<header class="mobail_menu d-none d-block d-xs-block d-sm-block d-md-none d-lg-none d-xl-none">
<div class="container-fluid">
<div class="row">
<div class="col-xs-6 col-sm-6 col-6">
<div class="hs_logo">
<a href="index-2.html">
<img src="images/Sri-Lanka-Railway-Department.png" style="height: 70px; padding-bottom: 10%;" class="img-responsive" alt="logo" title="Logo" />
</a>
</div>
</div>
<div class="col-xs-6 col-sm-6 col-6">
<div class="cd-dropdown-wrapper">
<a class="house_toggle" href="#0">
<svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="511.63px" height="511.631px" viewBox="0 0 511.63 511.631" style="enable-background:new 0 0 511.63 511.631;" xml:space="preserve">
<g>
<g>
<path d="M493.356,274.088H18.274c-4.952,0-9.233,1.811-12.851,5.428C1.809,283.129,0,287.417,0,292.362v36.545
c0,4.948,1.809,9.236,5.424,12.847c3.621,3.617,7.904,5.432,12.851,5.432h475.082c4.944,0,9.232-1.814,12.85-5.432
c3.614-3.61,5.425-7.898,5.425-12.847v-36.545c0-4.945-1.811-9.233-5.425-12.847C502.588,275.895,498.3,274.088,493.356,274.088z" />
<path d="M493.356,383.721H18.274c-4.952,0-9.233,1.81-12.851,5.427C1.809,392.762,0,397.046,0,401.994v36.546
c0,4.948,1.809,9.232,5.424,12.854c3.621,3.61,7.904,5.421,12.851,5.421h475.082c4.944,0,9.232-1.811,12.85-5.421
c3.614-3.621,5.425-7.905,5.425-12.854v-36.546c0-4.948-1.811-9.232-5.425-12.847C502.588,385.53,498.3,383.721,493.356,383.721z" />
<path d="M506.206,60.241c-3.617-3.612-7.905-5.424-12.85-5.424H18.274c-4.952,0-9.233,1.812-12.851,5.424
C1.809,63.858,0,68.143,0,73.091v36.547c0,4.948,1.809,9.229,5.424,12.847c3.621,3.616,7.904,5.424,12.851,5.424h475.082
c4.944,0,9.232-1.809,12.85-5.424c3.614-3.617,5.425-7.898,5.425-12.847V73.091C511.63,68.143,509.82,63.861,506.206,60.241z" />
<path d="M493.356,164.456H18.274c-4.952,0-9.233,1.807-12.851,5.424C1.809,173.495,0,177.778,0,182.727v36.547
c0,4.947,1.809,9.233,5.424,12.845c3.621,3.617,7.904,5.429,12.851,5.429h475.082c4.944,0,9.232-1.812,12.85-5.429
c3.614-3.612,5.425-7.898,5.425-12.845v-36.547c0-4.952-1.811-9.231-5.425-12.847C502.588,166.263,498.3,164.456,493.356,164.456z
" />
</g>
</g>
<g></g>
<g></g>
<g></g>
<g></g>
<g></g>
<g></g>
<g></g>
<g></g>
<g></g>
<g></g>
<g></g>
<g></g>
<g></g>
<g></g>
<g></g>
</svg>
</a>
<!-- .cd-dropdown -->
</div>
<nav class="cd-dropdown">
<h2><a href="javascript:void(0)" onclick="naviHome()">Sri Lanka Railway</a></h2>
<a href="#0" class="cd-close">Close</a>
<ul class="cd-dropdown-content">
<li>
<form class="cd-search">
<input type="search" placeholder="">
</form>
</li>
<li> <a href="javascript:void(0)" onclick="naviHome()">Home</a></li>
</ul>
<!-- .cd-dropdown-content -->
</nav>
</div>
</div>
</div>
<!-- .cd-dropdown-wrapper -->
</header>
</div>
</div>
</div>
</div>
\ No newline at end of file
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
/*
Flaticon icon font: Flaticon
Creation date: 26/12/2018 10:46
*/
@font-face {
font-family: "Flaticon";
src: url("../fonts/Flaticon.eot");
src: url("../fonts/Flaticond41d.eot?#iefix") format("embedded-opentype"),
url("../fonts/Flaticon.woff") format("woff"),
url("../fonts/Flaticon.ttf") format("truetype"),
url("http://www.xdemos.space/xpedia/fonts/Flaticon.svg#Flaticon") format("svg");
font-weight: normal;
font-style: normal;
}
@media screen and (-webkit-min-device-pixel-ratio:0) {
@font-face {
font-family: "Flaticon";
src: url("http://www.xdemos.space/xpedia/css/Flaticon.svg#Flaticon") format("svg");
}
}
[class^="flaticon-"]:before, [class*=" flaticon-"]:before,
[class^="flaticon-"]:after, [class*=" flaticon-"]:after {
font-family: Flaticon;
font-size: 20px;
font-style: normal;
margin-left: 20px;
}
.flaticon-shopping-cart:before { content: "\f100"; }
.flaticon-right-arrow:before { content: "\f101"; }
.flaticon-left-arrow:before { content: "\f102"; }
.flaticon-left-arrow-chevron:before { content: "\f103"; }
.flaticon-angle-arrow-pointing-to-right:before { content: "\f104"; }
.flaticon-magnifying-glass:before { content: "\f105"; }
.flaticon-world:before { content: "\f106"; }
.flaticon-checklist:before { content: "\f107"; }
.flaticon-car-trip:before { content: "\f108"; }
.flaticon-airplane-shape:before { content: "\f109"; }
.flaticon-calendar:before { content: "\f10a"; }
.flaticon-sedan-car-front:before { content: "\f10b"; }
.flaticon-emoticon-square-smiling-face-with-closed-eyes:before { content: "\f10c"; }
.flaticon-home-page:before { content: "\f10d"; }
.flaticon-phone-call:before { content: "\f10e"; }
.flaticon-pie-chart:before { content: "\f10f"; }
.flaticon-menu:before { content: "\f110"; }
.flaticon-multiple-users-silhouette:before { content: "\f111"; }
.flaticon-cup-of-hot-chocolate:before { content: "\f112"; }
.flaticon-mail-send:before { content: "\f113"; }
.flaticon-speedometer:before { content: "\f114"; }
.flaticon-shopping-bag:before { content: "\f115"; }
.flaticon-code:before { content: "\f116"; }
.flaticon-idea:before { content: "\f117"; }
.flaticon-pencil-black-tool-interface-symbol:before { content: "\f118"; }
.flaticon-people:before { content: "\f119"; }
.flaticon-list:before { content: "\f11a"; }
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
/**
* Owl Carousel v2.2.1
* Copyright 2013-2017 David Deutsch
* Licensed under ()
*/
/*
* Default theme - Owl Carousel CSS File
*/
.owl-theme .owl-nav {
margin-top: 10px;
text-align: center;
-webkit-tap-highlight-color: transparent; }
.owl-theme .owl-nav [class*='owl-'] {
color: #FFF;
font-size: 14px;
margin: 5px;
padding: 4px 7px;
background: #D6D6D6;
display: inline-block;
cursor: pointer;
border-radius: 3px; }
.owl-theme .owl-nav [class*='owl-']:hover {
background: #869791;
color: #FFF;
text-decoration: none; }
.owl-theme .owl-nav .disabled {
opacity: 0.5;
cursor: default; }
.owl-theme .owl-nav.disabled + .owl-dots {
margin-top: 10px; }
.owl-theme .owl-dots {
text-align: center;
-webkit-tap-highlight-color: transparent; }
.owl-theme .owl-dots .owl-dot {
display: inline-block;
zoom: 1;
*display: inline; }
.owl-theme .owl-dots .owl-dot span {
width: 10px;
height: 10px;
margin: 5px 7px;
background: #D6D6D6;
display: block;
-webkit-backface-visibility: visible;
transition: opacity 200ms ease;
border-radius: 30px; }
.owl-theme .owl-dots .owl-dot.active span, .owl-theme .owl-dots .owl-dot:hover span {
background: #869791; }
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
@charset "utf-8";
@import url("animate.css");
@import url("bootstrap.min.css");
@import url("fonts.css");
@import url("flaticon.css");
@import url("font-awesome.css");
@import url("select2.min.css");
@import url("nice-select.css");
@import url("owl.carousel.css");
@import url("owl.theme.default.css");
@import url("magnific-popup.css");
@import url("reset.css");
@import url("style.css");
@import url("responsive.css");
\ No newline at end of file
@charset "utf-8";
@import url("animate.css");
@import url("bootstrap.min.css");
@import url("fonts.css");
@import url("flaticon.css");
@import url("font-awesome.css");
@import url("select2.min.css");
@import url("nice-select.css");
@import url("owl.carousel.css");
@import url("owl.theme.default.css");
@import url("magnific-popup.css");
@import url("reset.css");
@import url("style_II.css");
@import url("responsive_II.css");
\ No newline at end of file
File added
<?php
$db_host = "localhost";
$db_user = "root";
$db_password = "";
$db_database = "railway";
$con = mysqli_connect($db_host,$db_user,$db_password, $db_database);
?>
\ No newline at end of file
This diff is collapsed.
.btn{
margin-bottom: 10px;
}
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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