def __init__(self, img, layout='vertical', order=['R', 'G', 'B', 'V']): QFrame.__init__(self) r, g, b, v = histograms(img, 100) self.r_hist = ColorHistogram(r, (255, 0, 0)) self.g_hist = ColorHistogram(g, (0, 255, 0)) self.b_hist = ColorHistogram(b, (0, 0, 255)) self.v_hist = ColorHistogram(v, (0, 0, 0)) self.setFrameStyle(QFrame.StyledPanel | QFrame.Sunken) self.layout = QGridLayout(self) self.layout.setMargin(0) order_map = { 'R': self.r_hist, 'G': self.g_hist, 'B': self.b_hist, 'V': self.v_hist } if layout == 'vertical': for i in range(len(order)): self.layout.addWidget(order_map[order[i]], i, 0) elif layout == 'horizontal': for i in range(len(order)): self.layout.addWidget(order_map[order[i]], 0, i)
def __init__(self, img, layout='vertical', order=['R', 'G', 'B', 'V']): QWidget.__init__(self) r, g, b, v = histograms(img, 100) self.r_hist = ColorHistogram(r, (255, 0, 0)) self.g_hist = ColorHistogram(g, (0, 255, 0)) self.b_hist = ColorHistogram(b, (0, 0, 255)) self.v_hist = ColorHistogram(v, (0, 0, 0)) self.layout = QGridLayout(self) order_map = {'R': self.r_hist, 'G': self.g_hist, 'B': self.b_hist, 'V': self.v_hist} if layout=='vertical': for i in range(len(order)): self.layout.addWidget(order_map[order[i]], i, 0) elif layout=='horizontal': for i in range(len(order)): self.layout.addWidget(order_map[order[i]], 0, i)
def __init__(self, img, layout="vertical", order=["R", "G", "B", "V"]): QFrame.__init__(self) r, g, b, v = histograms(img, 100) self.r_hist = ColorHistogram(r, (255, 0, 0)) self.g_hist = ColorHistogram(g, (0, 255, 0)) self.b_hist = ColorHistogram(b, (0, 0, 255)) self.v_hist = ColorHistogram(v, (0, 0, 0)) self.setFrameStyle(QFrame.StyledPanel | QFrame.Sunken) self.layout = QGridLayout(self) self.layout.setMargin(0) order_map = {"R": self.r_hist, "G": self.g_hist, "B": self.b_hist, "V": self.v_hist} if layout == "vertical": for i in range(len(order)): self.layout.addWidget(order_map[order[i]], i, 0) elif layout == "horizontal": for i in range(len(order)): self.layout.addWidget(order_map[order[i]], 0, i)
def update_hists(self, img): r, g, b, v = histograms(img, 100) self.r_hist.update_hist(r, (255, 0, 0)) self.g_hist.update_hist(g, (0, 255, 0)) self.b_hist.update_hist(b, (0, 0, 255)) self.v_hist.update_hist(v, (0, 0, 0))
"<h1 style='text-align: center; color:#295E61 ;'>Film Box Office Exploratory Data Analysis and Model</h1>", unsafe_allow_html=True) st.write( """This web app contains an Exploratory Data Analysis on American Films since the 1990s with a total of around 6000 movies. It also contains a Random Forest model that predicts a films box office with data from before released. All the data is scrapped from wikipedia so the data is expected to be slightly off""" ) if option == 'Exploratory Data Analysis': col1, col2 = st.beta_columns(2) col1.markdown( "<h3 style='text-align: center; color:#295E61 ;'> Numerical Distributions</h3>", unsafe_allow_html=True) col1.pyplot(util.histograms(util.df)) col2.markdown( "<h3 style='text-align: center; color:#295E61 ;'> Numerical Data Overview</h3>", unsafe_allow_html=True) col2.dataframe(util.df[['Box office', 'Budget', 'Running time']].describe()) ## counts bar charts st.markdown( "<h2 style='text-align: center; color:#295E61 ;'>Movie Statistical Counts </h2>", unsafe_allow_html=True) st.pyplot(util.plot_counts(util.df)) st.markdown( "<h4 style='text-align: center; color:#295E61 ;'>Observations</h4>", unsafe_allow_html=True)