InHUMAN commited on
Commit
4cc4ecf
1 Parent(s): 2cf6a8e

large file

Browse files
Files changed (5) hide show
  1. .gitattributes +1 -0
  2. app.py +48 -0
  3. games.pkl +3 -0
  4. requiements.txt +0 -0
  5. similarities.pkl +3 -0
.gitattributes CHANGED
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ .pkl filter=lfs diff=lfs merge=lfs -text
app.py ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ import pickle
3
+ import pandas as pd
4
+ from PIL import Image
5
+ import requests
6
+ from bs4 import BeautifulSoup
7
+
8
+ st.title('Game Recommendation System')
9
+
10
+ game_list=pickle.load(open('games.pkl','rb'))
11
+ similarity_list=pickle.load(open('similarities.pkl','rb'))
12
+ games=pd.DataFrame(game_list)
13
+
14
+ def game_recommender(game):
15
+ game_index=games[games['name']==game].index[0]
16
+ distances=sorted(list(enumerate(similarity_list[game_index])),reverse=True, key=lambda x:x[1])[1:10]
17
+ game_recs=[]
18
+ for i in distances:
19
+ game_recs.append(games.iloc[i[0]]['name'])
20
+ return game_recs
21
+
22
+
23
+ game_selected=st.selectbox('',(games['name']))
24
+
25
+
26
+ if st.button('Recommend'):
27
+
28
+ game_recs=game_recommender(game_selected)
29
+ for i in game_recs:
30
+ word = f'latest {i} video game cover photo'
31
+ url = 'https://www.google.com/search?q={0}&tbm=isch'.format(word)
32
+ content = requests.get(url).content
33
+ soup = BeautifulSoup(content,'lxml')
34
+ images = soup.findAll('img')
35
+ c=0
36
+ img_link=''
37
+ for image in images:
38
+ if c==1:
39
+ img_link=image.get('src')
40
+ break
41
+ c+=1
42
+
43
+ im = Image.open(requests.get(img_link, stream=True).raw)
44
+ st.header(i)
45
+ st.image(im)
46
+
47
+
48
+
games.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c2037db698235f5aa1ed7b1f1543342275bb6ff6abc8e81cbf87521ab95328f9
3
+ size 1889758
requiements.txt ADDED
Binary file (40 Bytes). View file
 
similarities.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:27b4b32d6be09813d0627cab171a36444445f9c0445e23535c31a6b8d5a4b45c
3
+ size 975406275