upload app
Browse files
app.py
ADDED
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
import pandas as pd
|
3 |
+
import joblib
|
4 |
+
from PIL import Image
|
5 |
+
|
6 |
+
st.set_page_config(layout="wide")
|
7 |
+
|
8 |
+
header = st.container()
|
9 |
+
dataset = st.container()
|
10 |
+
recommendation = st.container()
|
11 |
+
|
12 |
+
with header:
|
13 |
+
header_ = '<p style="font-family:sans-serif; color:darkcyan; font-size: 46px;">MOVIE RECOMMENDATION</p>'
|
14 |
+
st.markdown(header_, unsafe_allow_html=True)
|
15 |
+
text0 = '<p style="font-family:Courier; color:firebrick; font-size: 24px;">With this application, we would like to make a list of movies that you will love watching!</p>'
|
16 |
+
st.markdown(text0, unsafe_allow_html=True)
|
17 |
+
|
18 |
+
with dataset:
|
19 |
+
st.header('WE BRING TO YOU THE BEST MOVIE COLLECTION')
|
20 |
+
col1, col2, col3 , col4, col5 = dataset.columns(5)
|
21 |
+
logo_netflix = Image.open('source/image_streamlit/netflix.jpg')
|
22 |
+
logo_amazon_prime = Image.open('source/image_streamlit/primevideo.png')
|
23 |
+
logo_apple_tv = Image.open('source/image_streamlit/apple_tv.png')
|
24 |
+
logo_hbo = Image.open('source/image_streamlit/HBO.jpg')
|
25 |
+
logo_disney = Image.open('source/image_streamlit/disney.png')
|
26 |
+
logo_paramount = Image.open('source/image_streamlit/paramount.png')
|
27 |
+
with col1:
|
28 |
+
st.image(logo_netflix)
|
29 |
+
st.image(logo_hbo)
|
30 |
+
with col3:
|
31 |
+
st.image(logo_amazon_prime)
|
32 |
+
st.image(logo_apple_tv)
|
33 |
+
with col5:
|
34 |
+
st.image(logo_paramount)
|
35 |
+
st.image(logo_disney)
|
36 |
+
|
37 |
+
with recommendation:
|
38 |
+
st.header('LET US MAKE RECOMMENDATION TO YOU')
|
39 |
+
text1 = '<p style="font-family:Courier; color:darkcyan; font-size: 20px;">Now you show us one of your favorite movies ...</p>'
|
40 |
+
st.markdown(text1, unsafe_allow_html=True)
|
41 |
+
text2 = '<p style="font-family:Courier; color:darkcyan; font-size: 20px;">... then let we recommend you movies that you will love!</p>'
|
42 |
+
st.markdown(text2, unsafe_allow_html=True)
|
43 |
+
|
44 |
+
frame = joblib.load('source/model/pickle_frame.joblib')
|
45 |
+
st.write('### **SELECT** or **TYPE** here below the movie title you loved watching:')
|
46 |
+
movie_chosen = st.selectbox('', options=[title for title in frame.columns.sort_values()])
|
47 |
+
st.write('### **Your favourite movie chosen:**')
|
48 |
+
st.subheader(movie_chosen)
|
49 |
+
st.write('### **Here are movies that we recommend you:**', unsafe_allow_html=True)
|
50 |
+
recommendation_list = list(frame[movie_chosen].sort_values(ascending=False)[1:11].index.values)
|
51 |
+
title = ''
|
52 |
+
for i in recommendation_list:
|
53 |
+
title += "- " + i + "\n"
|
54 |
+
st.markdown(title)
|
55 |
+
|
56 |
+
|