Spaces:
Runtime error
Runtime error
Added Platform Listing
Browse files
app.py
CHANGED
|
@@ -45,16 +45,28 @@ def recommend_games(user_game_name_input):
|
|
| 45 |
reverse=True
|
| 46 |
)
|
| 47 |
|
| 48 |
-
recommendations = []
|
| 49 |
-
chart_data = []
|
| 50 |
for i, (index, score) in enumerate(sorted_similar_games[1:21]):
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 58 |
|
| 59 |
chart_df = pd.DataFrame(chart_data)
|
| 60 |
return "\n".join(recommendations), chart_df
|
|
|
|
| 45 |
reverse=True
|
| 46 |
)
|
| 47 |
|
|
|
|
|
|
|
| 48 |
for i, (index, score) in enumerate(sorted_similar_games[1:21]):
|
| 49 |
+
if score < 0.3:
|
| 50 |
+
continue
|
| 51 |
+
game_name = data.iloc[index]['name']
|
| 52 |
+
|
| 53 |
+
# Get OS support info
|
| 54 |
+
platforms = data.iloc[index].get('platforms', '').lower()
|
| 55 |
+
os_icons = []
|
| 56 |
+
if 'windows' in platforms:
|
| 57 |
+
os_icons.append("🪟")
|
| 58 |
+
if 'mac' in platforms or 'macos' in platforms:
|
| 59 |
+
os_icons.append("🍎")
|
| 60 |
+
if 'linux' in platforms or 'steam' in platforms:
|
| 61 |
+
os_icons.append("🐧")
|
| 62 |
+
|
| 63 |
+
os_display = ' '.join(os_icons) if os_icons else "❓"
|
| 64 |
+
|
| 65 |
+
recommendations.append(f"{i+1}. {game_name} {os_display} (Similarity: {score:.2f})")
|
| 66 |
+
chart_data.append({'Game': game_name, 'Similarity': score})
|
| 67 |
+
|
| 68 |
+
if len(recommendations) >= 10:
|
| 69 |
+
break
|
| 70 |
|
| 71 |
chart_df = pd.DataFrame(chart_data)
|
| 72 |
return "\n".join(recommendations), chart_df
|