-
Notifications
You must be signed in to change notification settings - Fork 0
/
code.rtf
86 lines (86 loc) · 4.4 KB
/
code.rtf
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
{\rtf1\ansi\ansicpg1252\deff0\nouicompat\deflang2070{\fonttbl{\f0\fnil\fcharset0 Calibri;}}
{\*\generator Riched20 10.0.18362}\viewkind4\uc1
\pard\sa200\sl276\slmult1\f0\fs22\lang22 from PyQt5 import QtCore, QtGui, QtWidgets\par
import pandas as pd\par
import numpy as np\par
import recommendations\par
\par
movies=pd.read_csv("movie4.csv") #saving the title of the movies inside of combobox\par
movt=movies["title"].dropna()\par
movies_titles = movt.values.tolist()\par
#saving the genre of movies\par
genres=["Action","Adventure","Animation","Children's","Comedy",\par
"Crime","Documentary","Drama","Fantasy","Film-Noir",\par
"Horror","Musical","Mystery","Romance","Sci-Fi",\par
"Thriller", "War", "Western"]\par
\par
#saving the selected movie from combobox\par
self.Movies.addItems(movies_titles)\par
#saving the selected genre from the QComboBox\par
self.Genresbar.addItems(genres)\par
#creating and buttons\par
def home_page():\par
self.tabWidget.setCurrentIndex(0)\par
\par
def action_page():\par
self.tabWidget.setCurrentIndex(1)\par
\par
def discover_page():\par
self.tabWidget.setCurrentIndex(2)\par
\par
def about_page():\par
self.tabWidget.setCurrentIndex(3)\par
\par
\par
#adding items\par
def adding_items():\par
self.listWidget.clear()\par
\par
item=self.Movies.currentText()\par
lista=recommendations.print_similar_movies(item)\par
self.listWidget.addItems(recommendations.your_movie(item)[0:2])\par
self.listWidget.addItem(str("\{\}\{:.1f\}".format("Rating: ",recommendations.your_movie(item)[2])))\par
#titles\par
self.titler.setText(lista[0][0])\par
self.titler2.setText(lista[1][0])\par
self.titler3.setText(lista[2][0])\par
self.titler4.setText(lista[3][0])\par
self.titler5.setText(lista[4][0])\par
self.genrer.setText(lista[0][1])\par
self.genrer2.setText(lista[1][1])\par
self.genrer3.setText(lista[2][1])\par
self.genrer4.setText(lista[3][1])\par
self.genrer5.setText(lista[4][1])\par
self.rating.setText(str("\{:.1f\}".format(lista[0][2])))\par
self.rating2.setText(str("\{:.1f\}".format(lista[1][2])))\par
self.rating3.setText(str("\{:.1f\}".format(lista[2][2])))\par
self.rating4.setText(str("\{:.1f\}".format(lista[3][2])))\par
self.rating5.setText(str("\{:.1f\}".format(lista[4][2])))\par
\par
def addding_items2():\par
genre=self.Genresbar.currentText()\par
rouList=recommendations.randomize(genre)\par
self.titler_2.setText(rouList[0][0])\par
self.titler2_2.setText(rouList[1][0])\par
self.titler3_2.setText(rouList[2][0])\par
self.titler4_2.setText(rouList[3][0])\par
self.titler5_2.setText(rouList[4][0])\par
self.genrer_2.setText(rouList[0][1])\par
self.genrer2_2.setText(rouList[1][1])\par
self.genrer3_2.setText(rouList[2][1])\par
self.genrer4_2.setText(rouList[3][1])\par
self.genrer5_2.setText(rouList[4][1])\par
self.rating_5.setText(str("\{:.1f\}".format(rouList[0][2])))\par
self.rating2_5.setText(str("\{:.1f\}".format(rouList[1][2])))\par
self.rating3_5.setText(str("\{:.1f\}".format(rouList[2][2])))\par
self.rating4_5.setText(str("\{:.1f\}".format(rouList[3][2])))\par
self.rating5_5.setText(str("\{:.1f\}".format(rouList[4][2])))\par
\par
self.pushButton.clicked.connect(home_page)#link between home button and homepage\par
self.pushButton_2.clicked.connect(action_page)#link between Movies button and moviepage\par
self.pushButton_3.clicked.connect(adding_items)#Enter button from moviespage linked to additems fuction\par
self.About.clicked.connect(about_page)#link between about button and aboutpage\par
self.pushButton_15.clicked.connect(discover_page)#link between discover button and discoverpage\par
self.pushButton_14.clicked.connect(addding_items2)#enter button for discoverpager linked to additem2 fuction\par
}