Bnava13 commited on
Commit
c053461
ยท
verified ยท
1 Parent(s): f0b3b0a

Added Emoji Legend and Similarity Changed to Percentage

Browse files
Files changed (1) hide show
  1. app.py +11 -9
app.py CHANGED
@@ -50,10 +50,9 @@ def recommend_games(user_game_name_input):
50
  for i, (index, score) in enumerate(sorted_similar_games[1:21]):
51
  if score < 0.3:
52
  continue
 
53
  game_name = data.iloc[index]['name']
54
-
55
- # Get OS support info
56
- platforms = data.iloc[index].get('platforms', '').lower()
57
  os_icons = []
58
  if 'windows' in platforms:
59
  os_icons.append("๐ŸชŸ")
@@ -61,12 +60,12 @@ def recommend_games(user_game_name_input):
61
  os_icons.append("๐ŸŽ")
62
  if 'linux' in platforms or 'steam' in platforms:
63
  os_icons.append("๐Ÿง")
64
-
65
  os_display = ' '.join(os_icons) if os_icons else "โ“"
66
-
67
- recommendations.append(f"{i+1}. {game_name} {os_display} (Similarity: {score:.2f})")
68
- chart_data.append({'Game': game_name, 'Similarity': score})
69
-
70
  if len(recommendations) >= 10:
71
  break
72
 
@@ -99,7 +98,7 @@ def recommend_and_visualize(user_input):
99
 
100
  if chart_df is not None and not chart_df.empty:
101
  chart = px.bar(chart_df, x="Game", y="Similarity", title="Top Game Recommendations",
102
- labels={"Similarity": "Cosine Similarity Score"}, height=400)
103
 
104
  return recommendations + f"\n\nPrecision@5 (approx): {precision}", chart
105
 
@@ -107,6 +106,9 @@ def recommend_and_visualize(user_input):
107
  with gr.Blocks() as demo:
108
  gr.Markdown("## ๐ŸŽฎ Steam Game Recommender")
109
  gr.Markdown("Enter the name of a game you like and get recommendations based on similarity!")
 
 
 
110
 
111
  with gr.Row():
112
  input_box = gr.Textbox(label="Your Favorite Game", placeholder="e.g., Portal 2")
 
50
  for i, (index, score) in enumerate(sorted_similar_games[1:21]):
51
  if score < 0.3:
52
  continue
53
+
54
  game_name = data.iloc[index]['name']
55
+ platforms = str(data.iloc[index]['platforms']).lower()
 
 
56
  os_icons = []
57
  if 'windows' in platforms:
58
  os_icons.append("๐ŸชŸ")
 
60
  os_icons.append("๐ŸŽ")
61
  if 'linux' in platforms or 'steam' in platforms:
62
  os_icons.append("๐Ÿง")
63
+
64
  os_display = ' '.join(os_icons) if os_icons else "โ“"
65
+ score_percent = score * 100
66
+ recommendations.append(f"{i+1}. {game_name} {os_display} (Similarity: {score_percent:.1f}%)")
67
+ chart_data.append({'Game': game_name, 'Similarity': score_percent})
68
+
69
  if len(recommendations) >= 10:
70
  break
71
 
 
98
 
99
  if chart_df is not None and not chart_df.empty:
100
  chart = px.bar(chart_df, x="Game", y="Similarity", title="Top Game Recommendations",
101
+ labels={"Similarity": "Similarity (%)"}, height=400)
102
 
103
  return recommendations + f"\n\nPrecision@5 (approx): {precision}", chart
104
 
 
106
  with gr.Blocks() as demo:
107
  gr.Markdown("## ๐ŸŽฎ Steam Game Recommender")
108
  gr.Markdown("Enter the name of a game you like and get recommendations based on similarity!")
109
+
110
+ gr.Markdown("### ๐Ÿ’ป Platform Legend")
111
+ gr.Markdown("- ๐ŸชŸ = Windows \n- ๐ŸŽ = macOS \n- ๐Ÿง = Linux/SteamOS \n- โ“ = Unknown")
112
 
113
  with gr.Row():
114
  input_box = gr.Textbox(label="Your Favorite Game", placeholder="e.g., Portal 2")