ammar00200 commited on
Commit
3aaa0a3
·
verified ·
1 Parent(s): cfe1cb2

Upload 13 files

Browse files
api/Overall_recommendation_model.tflite ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:fda0bfd83ffce414d57735aac204a5d0140aeba667e17d6a646fcdcfdac0c72d
3
+ size 19652
api/api.py ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from flask import Flask, jsonify, request
2
+ import pickle
3
+ import pandas as pd
4
+ import numpy as np
5
+
6
+ app = Flask(__name__)
7
+
8
+ # Load pickled data
9
+ # Open the file using 'with' statement
10
+ with open('popular1.pkl', 'rb') as f:
11
+ popular_df = pd.read_pickle(f)
12
+ with open('pt1.pkl', 'rb') as fi:
13
+ pt = pd.read_pickle(fi)
14
+ with open('banquet.pkl', 'rb') as fil:
15
+ banquets = pd.read_pickle(fil)
16
+ with open('similarity_scores1.pkl', 'rb') as file:
17
+ similarity_scores = pd.read_pickle(file)
18
+ # Define a route to get recommendations
19
+ @app.route('/recommend/<string:n>',methods=['GET'])
20
+ def recommend(n):
21
+ # Get user input from request
22
+
23
+
24
+ # Perform recommendation logic
25
+ if n not in pt.index:
26
+ return "Banquet not found in the index"
27
+
28
+ index = np.where(pt.index == n)[0][0]
29
+ similar_items = sorted(enumerate(similarity_scores[index]), key=lambda x: x[1], reverse=True)[1:5]
30
+
31
+ data = []
32
+ for i in similar_items:
33
+ item = []
34
+ temp_df = banquets[banquets['Hall-Name'] == pt.index[i[0]]]
35
+ item.extend(temp_df.drop_duplicates('Hall-Name')['Hall-Name'].values)
36
+ item.extend(temp_df.drop_duplicates('Hall-Name')['Address'].values)
37
+ item.extend(temp_df.drop_duplicates('Hall-Name')['Contact'].values)
38
+ item.extend(temp_df.drop_duplicates('Hall-Name')['Rating'].values)
39
+ item.extend(temp_df.drop_duplicates('Hall-Name')['Jn12ke src'].values)
40
+ data.append(item)
41
+
42
+ return jsonify({'recommendations': data})
43
+
44
+ if __name__ == "__main__":
45
+ app.run(debug=True)
api/banquet.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:765c5e34a0cb69c1532ee84cc46125b8c4396d6ac8d50f1bd582809299b96698
3
+ size 33005
api/banquets.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:98ce9fbae514a1f09efe71a7a98cb6f8737b2da886bfbce108614ec3e7ab5aa6
3
+ size 6359
api/main.py ADDED
@@ -0,0 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from flask import Flask,jsonify,render_template,request
2
+ import pickle
3
+ import pandas as pd
4
+ import pandas as pd
5
+ import numpy as np
6
+
7
+ # Open the file using 'with' statement
8
+ with open('popular1.pkl', 'rb') as f:
9
+ popular_df = pd.read_pickle(f)
10
+ with open('pt1.pkl', 'rb') as fi:
11
+ pt = pd.read_pickle(fi)
12
+ with open('banquet.pkl', 'rb') as fil:
13
+ banquets = pd.read_pickle(fil)
14
+ with open('similarity_scores1.pkl', 'rb') as file:
15
+ similarity_scores = pd.read_pickle(file)
16
+
17
+
18
+ app = Flask(__name__)
19
+
20
+ @app.route('/')
21
+ def index():
22
+ return render_template(
23
+ 'index.html',
24
+ banquet_img=list(popular_df['Jn12ke src'].values),
25
+ banquet_name=list(popular_df['Hall-Name'].values),
26
+ banquet_reviews=list(popular_df['num_ratings'].values),
27
+ banquet_rating=list(popular_df['Rating_x'].values),
28
+
29
+
30
+ )
31
+ @app.route('/recommend')
32
+ def recommend_ui():
33
+ return render_template(
34
+
35
+ 'Recommend.html'
36
+ )
37
+
38
+ @app.route('/banquet',methods=['post'])
39
+ def recommend():
40
+ user_input=request.form.get('user-input')
41
+
42
+ if user_input not in pt.index:
43
+ return "Banquet not found in the index"
44
+
45
+ index = np.where(pt.index ==user_input)[0][0]
46
+ similar_items = sorted(enumerate(similarity_scores[index]), key=lambda x: x[1], reverse=True)[1:5]
47
+
48
+ data = []
49
+ for i in similar_items:
50
+ item = []
51
+ temp_df = banquets[banquets['Hall-Name'] == pt.index[i[0]]]
52
+ item.extend(temp_df.drop_duplicates('Hall-Name')['Hall-Name'].values)
53
+ item.extend(temp_df.drop_duplicates('Hall-Name')['Address'].values)
54
+ item.extend(temp_df.drop_duplicates('Hall-Name')['Contact'].values)
55
+ item.extend(temp_df.drop_duplicates('Hall-Name')['Rating'].values)
56
+ item.extend(temp_df.drop_duplicates('Hall-Name')['Jn12ke src'].values)
57
+
58
+ data.append(item)
59
+
60
+ print(data)
61
+
62
+ return jsonify({'recommendations': data})
63
+
64
+
65
+ if __name__=="__main__":
66
+ app.run(debug=True)
67
+
68
+
api/popular.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5ba59d9e149e95ade83f87d6c0e0b721710ade00c42fce47bb20bc9c32df6c66
3
+ size 2201
api/popular1.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:40eb61872ad5ace6d5744ae65f97b43c024b3ec521f38f4ca1fb18717b5538c2
3
+ size 3201
api/pt.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5cd60305a7bdf81c07d84c29c3ad815231b8e1f3d723611f7414ea4fbcfbb11f
3
+ size 26000
api/pt1.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5cd60305a7bdf81c07d84c29c3ad815231b8e1f3d723611f7414ea4fbcfbb11f
3
+ size 26000
api/similarity_scores.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5b37be1b672da2d9031d82a2cb8ced97a0065ff3a62f1be91fc7b366a9d6fb38
3
+ size 48824
api/similarity_scores1.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5b37be1b672da2d9031d82a2cb8ced97a0065ff3a62f1be91fc7b366a9d6fb38
3
+ size 48824
api/templates/Recommend.html ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>Banquet Recommender</title>
7
+ <!-- Latest compiled and minified CSS -->
8
+ <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
9
+ </head>
10
+ <body style="background-color: black;">
11
+
12
+ <nav class="navbar">
13
+ <p class="navbar-brand" style="color: aliceblue;">Banquet Recommender</p>
14
+ <ul>
15
+ <li><a href="/">Home</a></li>
16
+ <li><a href="/recommend">Recommend</a></li>
17
+ </ul>
18
+ </nav>
19
+
20
+ <div class="container">
21
+ <div class="row">
22
+ <div class="col-md-12">
23
+ <h1 class="text-white" style="font-size: 50px;">Recommend Banquet</h1>
24
+ <form action="/banquet" method="post">
25
+ <input name="user-input" type="text" class="form-control form-control"><br>
26
+ <input type="submit" class="btn btn-lg btn-warning">
27
+ </form>
28
+ </div>
29
+ {% if data %}
30
+ {% for i in data %}
31
+ <div class="col-md-3" style="margin-top: 50px;">
32
+ <div class="card">
33
+ <div class="card-body">
34
+ <img class="card-img-top" src="{{i[4]}}", style="max-width: 100%; max-height: 200px;">>
35
+ <h3 style="color: #f9f8f8 "> Name: {{i[0]}}</h2>
36
+ <h4 style="color: #f9f8f8" > Address: {{i[1]}}</h4>
37
+ <h4 style="color: #f9f8f8 ">Phone No:{{i[2]}}</h4>
38
+ <h4 style="color: #f9f8f8" > Rating: {{i[3]}}</h4>
39
+ </div>
40
+ </div>
41
+ </div>
42
+ {% endfor %}
43
+ {% endif %}
44
+
45
+ </div>
46
+ </div>
47
+
48
+ </body>
49
+ </html>
api/templates/index.html ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>Banquet Recommender</title>
7
+ <!-- Latest compiled and minified CSS -->
8
+ <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
9
+ </head>
10
+ <body style="background-color: black;">
11
+
12
+ <nav class="navbar">
13
+ <p class="navbar-brand" style="color: aliceblue;">Banquet Recommender</p>
14
+ <ul class="nav navbar-nav">
15
+ <li><a href="/">Home</a></li>
16
+ <li><a href="/recommend">Recommend</a></li>
17
+ </ul>
18
+ </nav>
19
+
20
+ <div class="container">
21
+ <div class="row">
22
+ <div class="col-md-12">
23
+ <h1 class="text-white" style="font-size: 50px;">Top 50 Halls</h1>
24
+ </div>
25
+
26
+ {% for i in range(banquet_name|length) %}
27
+ <div class="col-md-3" style="margin-top: 50px;">
28
+ <div class="card">
29
+ <div class="card-body">
30
+ <img class="card-img-top" src="{{ banquet_img[i] }}", style="max-width: 100%; max-height: 200px;">
31
+ <h1>{{ banquet_name[i] }}</h1>
32
+ <h4>Reviews: {{ banquet_reviews[i] }}</h4>
33
+ <h4>Rating: {{ banquet_rating[i] }}</h4>
34
+ </div>
35
+ </div>
36
+ </div>
37
+ {% endfor %}
38
+ </div>
39
+ </div>
40
+
41
+ </body>
42
+ </html>