forked from mayank8823/Movie-Recommendation-System
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
586 lines (472 loc) · 23.4 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
# import numpy as np
# import pandas as pd
# from flask import Flask, render_template, request
# from sklearn.feature_extraction.text import CountVectorizer
# from sklearn.metrics.pairwise import cosine_similarity
# import json
# import bs4 as bs
# import urllib.request
# import pickle
# import requests
# from flask import redirect, url_for
# from datetime import date, datetime
# # load the nlp model and tfidf vectorizer from disk
# filename = 'nlp_model.pkl'
# clf = pickle.load(open(filename, 'rb'))
# vectorizer = pickle.load(open('tranform.pkl','rb'))
# # converting list of string to list (eg. "["abc","def"]" to ["abc","def"])
# def convert_to_list(my_list):
# my_list = my_list.split('","')
# my_list[0] = my_list[0].replace('["','')
# my_list[-1] = my_list[-1].replace('"]','')
# return my_list
# # convert list of numbers to list (eg. "[1,2,3]" to [1,2,3])
# def convert_to_list_num(my_list):
# my_list = my_list.split(',')
# my_list[0] = my_list[0].replace("[","")
# my_list[-1] = my_list[-1].replace("]","")
# return my_list
# def get_suggestions():
# data = pd.read_csv('main_data.csv')
# return list(data['movie_title'].str.capitalize())
# app = Flask(__name__)
# @app.route("/")
# @app.route("/home")
# def home():
# suggestions = get_suggestions()
# return render_template('home.html',suggestions=suggestions)
# @app.route("/populate-matches",methods=["POST"])
# def populate_matches():
# # getting data from AJAX request
# res = json.loads(request.get_data("data"));
# movies_list = res['movies_list'];
# movie_cards = {"https://image.tmdb.org/t/p/original"+movies_list[i]['poster_path'] if movies_list[i]['poster_path'] else "/static/movie_placeholder.jpeg": [movies_list[i]['title'],movies_list[i]['original_title'],movies_list[i]['vote_average'],datetime.strptime(movies_list[i]['release_date'], '%Y-%m-%d').year if movies_list[i]['release_date'] else "N/A", movies_list[i]['id']] for i in range(len(movies_list))}
# return render_template('recommend.html',movie_cards=movie_cards);
# @app.route("/recommend",methods=["POST"])
# def recommend():
# # getting data from AJAX request
# title = request.form['title']
# cast_ids = request.form['cast_ids']
# cast_names = request.form['cast_names']
# cast_chars = request.form['cast_chars']
# cast_bdays = request.form['cast_bdays']
# cast_bios = request.form['cast_bios']
# cast_places = request.form['cast_places']
# cast_profiles = request.form['cast_profiles']
# imdb_id = request.form['imdb_id']
# poster = request.form['poster']
# genres = request.form['genres']
# overview = request.form['overview']
# vote_average = request.form['rating']
# vote_count = request.form['vote_count']
# rel_date = request.form['rel_date']
# release_date = request.form['release_date']
# runtime = request.form['runtime']
# status = request.form['status']
# rec_movies = request.form['rec_movies']
# rec_posters = request.form['rec_posters']
# rec_movies_org = request.form['rec_movies_org']
# rec_year = request.form['rec_year']
# rec_vote = request.form['rec_vote']
# rec_ids = request.form['rec_ids']
# # get movie suggestions for auto complete
# suggestions = get_suggestions()
# # call the convert_to_list function for every string that needs to be converted to list
# rec_movies_org = convert_to_list(rec_movies_org)
# rec_movies = convert_to_list(rec_movies)
# rec_posters = convert_to_list(rec_posters)
# cast_names = convert_to_list(cast_names)
# cast_chars = convert_to_list(cast_chars)
# cast_profiles = convert_to_list(cast_profiles)
# cast_bdays = convert_to_list(cast_bdays)
# cast_bios = convert_to_list(cast_bios)
# cast_places = convert_to_list(cast_places)
# # convert string to list (eg. "[1,2,3]" to [1,2,3])
# cast_ids = convert_to_list_num(cast_ids)
# rec_vote = convert_to_list_num(rec_vote)
# rec_year = convert_to_list_num(rec_year)
# rec_ids = convert_to_list_num(rec_ids)
# # rendering the string to python string
# for i in range(len(cast_bios)):
# cast_bios[i] = cast_bios[i].replace(r'\n', '\n').replace(r'\"','\"')
# for i in range(len(cast_chars)):
# cast_chars[i] = cast_chars[i].replace(r'\n', '\n').replace(r'\"','\"')
# # combining multiple lists as a dictionary which can be passed to the html file so that it can be processed easily and the order of information will be preserved
# movie_cards = {rec_posters[i]: [rec_movies[i],rec_movies_org[i],rec_vote[i],rec_year[i],rec_ids[i]] for i in range(len(rec_posters))}
# casts = {cast_names[i]:[cast_ids[i], cast_chars[i], cast_profiles[i]] for i in range(len(cast_profiles))}
# cast_details = {cast_names[i]:[cast_ids[i], cast_profiles[i], cast_bdays[i], cast_places[i], cast_bios[i]] for i in range(len(cast_places))}
# if(imdb_id != ""):
# # web scraping to get user reviews from IMDB site
# sauce = urllib.request.urlopen('https://www.imdb.com/title/{}/reviews?ref_=tt_ov_rt'.format(imdb_id)).read()
# soup = bs.BeautifulSoup(sauce,'lxml')
# soup_result = soup.find_all("div",{"class":"text show-more__control"})
# reviews_list = [] # list of reviews
# reviews_status = [] # list of comments (good or bad)
# for reviews in soup_result:
# if reviews.string:
# reviews_list.append(reviews.string)
# # passing the review to our model
# movie_review_list = np.array([reviews.string])
# movie_vector = vectorizer.transform(movie_review_list)
# pred = clf.predict(movie_vector)
# reviews_status.append('Positive' if pred else 'Negative')
# # getting current date
# movie_rel_date = ""
# curr_date = ""
# if(rel_date):
# today = str(date.today())
# curr_date = datetime.strptime(today,'%Y-%m-%d')
# movie_rel_date = datetime.strptime(rel_date, '%Y-%m-%d')
# # combining reviews and comments into a dictionary
# movie_reviews = {reviews_list[i]: reviews_status[i] for i in range(len(reviews_list))}
# # passing all the data to the html file
# return render_template('recommend.html',title=title,poster=poster,overview=overview,vote_average=vote_average,
# vote_count=vote_count,release_date=release_date,movie_rel_date=movie_rel_date,curr_date=curr_date,runtime=runtime,status=status,genres=genres,movie_cards=movie_cards,reviews=movie_reviews,casts=casts,cast_details=cast_details)
# else:
# return render_template('recommend.html',title=title,poster=poster,overview=overview,vote_average=vote_average,
# vote_count=vote_count,release_date=release_date,movie_rel_date="",curr_date="",runtime=runtime,status=status,genres=genres,movie_cards=movie_cards,reviews="",casts=casts,cast_details=cast_details)
# @app.route('/login.html')
# def login():
# return render_template('login.html')
# # Route for handling form submission
# @app.route('/your-server-endpoint', methods=['POST'])
# def handle_registration():
# # Your registration logic here
# is_registration_successful = True
# if is_registration_successful:
# # Redirect to login page
# return redirect('/login.html')
# else:
# # Handle registration failure
# return "Registration failed. Please try again."
# @app.route('/contactus.html')
# def contact_us():
# return render_template('contactus.html')
# @app.route("/logout")
# def logout():
# return redirect(url_for('logout_page'))
# @app.route("/logout_page")
# def logout_page():
# return render_template('logout.html')
# if __name__ == '__main__':
# app.run(debug=True)
# import numpy as np
# import pandas as pd
# from flask import Flask, render_template, request
# from sklearn.feature_extraction.text import CountVectorizer
# from sklearn.metrics.pairwise import cosine_similarity
# import json
# import bs4 as bs
# import urllib.request
# import pickle
# import requests
# from flask import redirect, url_for
# from datetime import date, datetime
# # load the nlp model and tfidf vectorizer from disk
# filename = 'nlp_model.pkl'
# clf = pickle.load(open(filename, 'rb'))
# vectorizer = pickle.load(open('tranform.pkl','rb'))
# # converting list of string to list (eg. "["abc","def"]" to ["abc","def"])
# def convert_to_list(my_list):
# my_list = my_list.split('","')
# my_list[0] = my_list[0].replace('["','')
# my_list[-1] = my_list[-1].replace('"]','')
# return my_list
# # convert list of numbers to list (eg. "[1,2,3]" to [1,2,3])
# def convert_to_list_num(my_list):
# my_list = my_list.split(',')
# my_list[0] = my_list[0].replace("[","")
# my_list[-1] = my_list[-1].replace("]","")
# return my_list
# def get_suggestions():
# data = pd.read_csv('main_data.csv')
# return list(data['movie_title'].str.capitalize())
# app = Flask(__name__)
# @app.route("/")
# @app.route("/home")
# def home():
# suggestions = get_suggestions()
# return render_template('home.html',suggestions=suggestions)
# @app.route("/populate-matches",methods=["POST"])
# def populate_matches():
# # getting data from AJAX request
# res = json.loads(request.get_data("data"));
# movies_list = res['movies_list'];
# movie_cards = {"https://image.tmdb.org/t/p/original"+movies_list[i]['poster_path'] if movies_list[i]['poster_path'] else "/static/movie_placeholder.jpeg": [movies_list[i]['title'],movies_list[i]['original_title'],movies_list[i]['vote_average'],datetime.strptime(movies_list[i]['release_date'], '%Y-%m-%d').year if movies_list[i]['release_date'] else "N/A", movies_list[i]['id']] for i in range(len(movies_list))}
# return render_template('recommend.html',movie_cards=movie_cards);
# @app.route("/recommend",methods=["POST"])
# def recommend():
# # getting data from AJAX request
# title = request.form['title']
# cast_ids = request.form['cast_ids']
# cast_names = request.form['cast_names']
# cast_chars = request.form['cast_chars']
# cast_bdays = request.form['cast_bdays']
# cast_bios = request.form['cast_bios']
# cast_places = request.form['cast_places']
# cast_profiles = request.form['cast_profiles']
# imdb_id = request.form['imdb_id']
# poster = request.form['poster']
# genres = request.form['genres']
# overview = request.form['overview']
# vote_average = request.form['rating']
# vote_count = request.form['vote_count']
# rel_date = request.form['rel_date']
# release_date = request.form['release_date']
# runtime = request.form['runtime']
# status = request.form['status']
# rec_movies = request.form['rec_movies']
# rec_posters = request.form['rec_posters']
# rec_movies_org = request.form['rec_movies_org']
# rec_year = request.form['rec_year']
# rec_vote = request.form['rec_vote']
# rec_ids = request.form['rec_ids']
# # get movie suggestions for auto complete
# suggestions = get_suggestions()
# # call the convert_to_list function for every string that needs to be converted to list
# rec_movies_org = convert_to_list(rec_movies_org)
# rec_movies = convert_to_list(rec_movies)
# rec_posters = convert_to_list(rec_posters)
# cast_names = convert_to_list(cast_names)
# cast_chars = convert_to_list(cast_chars)
# cast_profiles = convert_to_list(cast_profiles)
# cast_bdays = convert_to_list(cast_bdays)
# cast_bios = convert_to_list(cast_bios)
# cast_places = convert_to_list(cast_places)
# # convert string to list (eg. "[1,2,3]" to [1,2,3])
# cast_ids = convert_to_list_num(cast_ids)
# rec_vote = convert_to_list_num(rec_vote)
# rec_year = convert_to_list_num(rec_year)
# rec_ids = convert_to_list_num(rec_ids)
# # rendering the string to python string
# for i in range(len(cast_bios)):
# cast_bios[i] = cast_bios[i].replace(r'\n', '\n').replace(r'\"','\"')
# for i in range(len(cast_chars)):
# cast_chars[i] = cast_chars[i].replace(r'\n', '\n').replace(r'\"','\"')
# # combining multiple lists as a dictionary which can be passed to the html file so that it can be processed easily and the order of information will be preserved
# movie_cards = {rec_posters[i]: [rec_movies[i],rec_movies_org[i],rec_vote[i],rec_year[i],rec_ids[i]] for i in range(len(rec_posters))}
# casts = {cast_names[i]:[cast_ids[i], cast_chars[i], cast_profiles[i]] for i in range(len(cast_profiles))}
# cast_details = {cast_names[i]:[cast_ids[i], cast_profiles[i], cast_bdays[i], cast_places[i], cast_bios[i]] for i in range(len(cast_places))}
# if(imdb_id != ""):
# # web scraping to get user reviews from IMDB site
# sauce = urllib.request.urlopen('https://www.imdb.com/title/{}/reviews?ref_=tt_ov_rt'.format(imdb_id)).read()
# soup = bs.BeautifulSoup(sauce,'lxml')
# soup_result = soup.find_all("div",{"class":"text show-more__control"})
# reviews_list = [] # list of reviews
# reviews_status = [] # list of comments (good or bad)
# for reviews in soup_result:
# if reviews.string:
# reviews_list.append(reviews.string)
# # passing the review to our model
# movie_review_list = np.array([reviews.string])
# movie_vector = vectorizer.transform(movie_review_list)
# pred = clf.predict(movie_vector)
# reviews_status.append('Positive' if pred else 'Negative')
# # getting current date
# movie_rel_date = ""
# curr_date = ""
# if(rel_date):
# today = str(date.today())
# curr_date = datetime.strptime(today,'%Y-%m-%d')
# movie_rel_date = datetime.strptime(rel_date, '%Y-%m-%d')
# # combining reviews and comments into a dictionary
# movie_reviews = {reviews_list[i]: reviews_status[i] for i in range(len(reviews_list))}
# # passing all the data to the html file
# return render_template('recommend.html',title=title,poster=poster,overview=overview,vote_average=vote_average,
# vote_count=vote_count,release_date=release_date,movie_rel_date=movie_rel_date,curr_date=curr_date,runtime=runtime,status=status,genres=genres,movie_cards=movie_cards,reviews=movie_reviews,casts=casts,cast_details=cast_details)
# else:
# return render_template('recommend.html',title=title,poster=poster,overview=overview,vote_average=vote_average,
# vote_count=vote_count,release_date=release_date,movie_rel_date="",curr_date="",runtime=runtime,status=status,genres=genres,movie_cards=movie_cards,reviews="",casts=casts,cast_details=cast_details)
# @app.route('/login.html')
# def login():
# return render_template('login.html')
# # Route for handling form submission
# @app.route('/your-server-endpoint', methods=['POST'])
# def handle_registration():
# # Your registration logic here
# is_registration_successful = True
# if is_registration_successful:
# # Redirect to login page
# return redirect('/login.html')
# else:
# # Handle registration failure
# return "Registration failed. Please try again."
# @app.route('/contactus.html')
# def contact_us():
# return render_template('contactus.html')
# @app.route("/logout")
# def logout():
# return redirect(url_for('logout_page'))
# @app.route("/logout_page")
# def logout_page():
# return render_template('logout.html')
# @app.route('/action')
# def action():
# return render_template('action.html')
# # @app.route('/review')
# # def review():
# # return render_template('review.html')
# if __name__ == '__main__':
# app.run(debug=True)
import numpy as np
import pandas as pd
from flask import Flask, render_template, request
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.metrics.pairwise import cosine_similarity
import json
import bs4 as bs
import urllib.request
import pickle
import requests
from flask import redirect, url_for
from datetime import date, datetime
# load the nlp model and tfidf vectorizer from disk
filename = 'nlp_model.pkl'
clf = pickle.load(open(filename, 'rb'))
vectorizer = pickle.load(open('tranform.pkl','rb'))
# converting list of string to list (eg. "["abc","def"]" to ["abc","def"])
def convert_to_list(my_list):
my_list = my_list.split('","')
my_list[0] = my_list[0].replace('["','')
my_list[-1] = my_list[-1].replace('"]','')
return my_list
# convert list of numbers to list (eg. "[1,2,3]" to [1,2,3])
def convert_to_list_num(my_list):
my_list = my_list.split(',')
my_list[0] = my_list[0].replace("[","")
my_list[-1] = my_list[-1].replace("]","")
return my_list
def get_suggestions():
data = pd.read_csv('main_data.csv')
return list(data['movie_title'].str.capitalize())
app = Flask(__name__)
@app.route("/")
@app.route("/home")
def home():
suggestions = get_suggestions()
return render_template('home.html',suggestions=suggestions)
@app.route("/populate-matches",methods=["POST"])
def populate_matches():
# getting data from AJAX request
res = json.loads(request.get_data("data"));
movies_list = res['movies_list'];
movie_cards = {"https://image.tmdb.org/t/p/original"+movies_list[i]['poster_path'] if movies_list[i]['poster_path'] else "/static/movie_placeholder.jpeg": [movies_list[i]['title'],movies_list[i]['original_title'],movies_list[i]['vote_average'],datetime.strptime(movies_list[i]['release_date'], '%Y-%m-%d').year if movies_list[i]['release_date'] else "N/A", movies_list[i]['id']] for i in range(len(movies_list))}
return render_template('recommend.html',movie_cards=movie_cards);
@app.route("/recommend",methods=["POST"])
def recommend():
# getting data from AJAX request
title = request.form['title']
cast_ids = request.form['cast_ids']
cast_names = request.form['cast_names']
cast_chars = request.form['cast_chars']
cast_bdays = request.form['cast_bdays']
cast_bios = request.form['cast_bios']
cast_places = request.form['cast_places']
cast_profiles = request.form['cast_profiles']
imdb_id = request.form['imdb_id']
poster = request.form['poster']
genres = request.form['genres']
overview = request.form['overview']
vote_average = request.form['rating']
vote_count = request.form['vote_count']
rel_date = request.form['rel_date']
release_date = request.form['release_date']
runtime = request.form['runtime']
status = request.form['status']
rec_movies = request.form['rec_movies']
rec_posters = request.form['rec_posters']
rec_movies_org = request.form['rec_movies_org']
rec_year = request.form['rec_year']
rec_vote = request.form['rec_vote']
rec_ids = request.form['rec_ids']
# get movie suggestions for auto complete
suggestions = get_suggestions()
# call the convert_to_list function for every string that needs to be converted to list
rec_movies_org = convert_to_list(rec_movies_org)
rec_movies = convert_to_list(rec_movies)
rec_posters = convert_to_list(rec_posters)
cast_names = convert_to_list(cast_names)
cast_chars = convert_to_list(cast_chars)
cast_profiles = convert_to_list(cast_profiles)
cast_bdays = convert_to_list(cast_bdays)
cast_bios = convert_to_list(cast_bios)
cast_places = convert_to_list(cast_places)
# convert string to list (eg. "[1,2,3]" to [1,2,3])
cast_ids = convert_to_list_num(cast_ids)
rec_vote = convert_to_list_num(rec_vote)
rec_year = convert_to_list_num(rec_year)
rec_ids = convert_to_list_num(rec_ids)
# rendering the string to python string
for i in range(len(cast_bios)):
cast_bios[i] = cast_bios[i].replace(r'\n', '\n').replace(r'\"','\"')
for i in range(len(cast_chars)):
cast_chars[i] = cast_chars[i].replace(r'\n', '\n').replace(r'\"','\"')
# combining multiple lists as a dictionary which can be passed to the html file so that it can be processed easily and the order of information will be preserved
movie_cards = {rec_posters[i]: [rec_movies[i],rec_movies_org[i],rec_vote[i],rec_year[i],rec_ids[i]] for i in range(len(rec_posters))}
casts = {cast_names[i]:[cast_ids[i], cast_chars[i], cast_profiles[i]] for i in range(len(cast_profiles))}
cast_details = {cast_names[i]:[cast_ids[i], cast_profiles[i], cast_bdays[i], cast_places[i], cast_bios[i]] for i in range(len(cast_places))}
if(imdb_id != ""):
# web scraping to get user reviews from IMDB site
sauce = urllib.request.urlopen('https://www.imdb.com/title/{}/reviews?ref_=tt_ov_rt'.format(imdb_id)).read()
soup = bs.BeautifulSoup(sauce,'lxml')
soup_result = soup.find_all("div",{"class":"text show-more__control"})
reviews_list = [] # list of reviews
reviews_status = [] # list of comments (good or bad)
for reviews in soup_result:
if reviews.string:
reviews_list.append(reviews.string)
# passing the review to our model
movie_review_list = np.array([reviews.string])
movie_vector = vectorizer.transform(movie_review_list)
pred = clf.predict(movie_vector)
reviews_status.append('Positive' if pred else 'Negative')
# getting current date
movie_rel_date = ""
curr_date = ""
if(rel_date):
today = str(date.today())
curr_date = datetime.strptime(today,'%Y-%m-%d')
movie_rel_date = datetime.strptime(rel_date, '%Y-%m-%d')
# combining reviews and comments into a dictionary
movie_reviews = {reviews_list[i]: reviews_status[i] for i in range(len(reviews_list))}
# passing all the data to the html file
return render_template('recommend.html',title=title,poster=poster,overview=overview,vote_average=vote_average,
vote_count=vote_count,release_date=release_date,movie_rel_date=movie_rel_date,curr_date=curr_date,runtime=runtime,status=status,genres=genres,movie_cards=movie_cards,reviews=movie_reviews,casts=casts,cast_details=cast_details)
else:
return render_template('recommend.html',title=title,poster=poster,overview=overview,vote_average=vote_average,
vote_count=vote_count,release_date=release_date,movie_rel_date="",curr_date="",runtime=runtime,status=status,genres=genres,movie_cards=movie_cards,reviews="",casts=casts,cast_details=cast_details)
@app.route('/login.html')
def login():
return render_template('login.html')
# Route for handling form submission
@app.route('/your-server-endpoint', methods=['POST'])
def handle_registration():
# Your registration logic here
is_registration_successful = True
if is_registration_successful:
# Redirect to login page
return redirect('/login.html')
else:
# Handle registration failure
return "Registration failed. Please try again."
@app.route('/contactus.html')
def contact_us():
return render_template('contactus.html')
@app.route("/logout")
def logout():
return redirect(url_for('logout_page'))
@app.route("/logout_page")
def logout_page():
return render_template('logout.html')
@app.route('/action')
def action():
return render_template('action.html')
@app.route('/review')
def review():
return render_template('review.html')
@app.route('/rate-us')
def rate_us():
# Redirect to the review page
return redirect(url_for('review'))
if __name__ == '__main__':
app.run(debug=True)