Bnava13 commited on
Commit
0995083
·
verified ·
1 Parent(s): 2b50b7d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -6
app.py CHANGED
@@ -90,12 +90,11 @@ def get_recommendations(game_name, data, feature_vectors):
90
 
91
  return result_html
92
 
93
-
94
  # Gradio interface function
95
  def recommend_games(game_name, max_age, max_price, min_metacritic):
96
  data = load_data()
97
  if data is None:
98
- return "Failed to load data. Please check the data file."
99
 
100
  # Apply filters BEFORE feature preparation
101
  data = data[
@@ -105,21 +104,20 @@ def recommend_games(game_name, max_age, max_price, min_metacritic):
105
  ].reset_index(drop=True)
106
 
107
  if data.empty:
108
- return "No games found matching your filter criteria."
109
 
110
  feature_vectors = prepare_features(data)
111
  recommendations_html = get_recommendations(game_name, data, feature_vectors)
112
 
113
  return recommendations_html
114
 
115
-
116
  # Create the Gradio interface
117
  with gr.Blocks(title="Steam Game Recommender") as demo:
118
  gr.Markdown("Steam Game Recommender")
119
  gr.Markdown("Enter a game you like and customize filters to get similar suggestions.")
120
 
121
  with gr.Row():
122
- input_text = gr.Textbox(label="Favorite Game")
123
 
124
  with gr.Row():
125
  max_age_slider = gr.Slider(0, 21, value=17, label="Max Age Rating (Avoid Adult Games)")
@@ -138,7 +136,6 @@ with gr.Blocks(title="Steam Game Recommender") as demo:
138
  outputs=output_text
139
  )
140
 
141
-
142
  # Launch the app
143
  if __name__ == "__main__":
144
  demo.launch()
 
90
 
91
  return result_html
92
 
 
93
  # Gradio interface function
94
  def recommend_games(game_name, max_age, max_price, min_metacritic):
95
  data = load_data()
96
  if data is None:
97
+ return "Failed to load data."
98
 
99
  # Apply filters BEFORE feature preparation
100
  data = data[
 
104
  ].reset_index(drop=True)
105
 
106
  if data.empty:
107
+ return "No games found."
108
 
109
  feature_vectors = prepare_features(data)
110
  recommendations_html = get_recommendations(game_name, data, feature_vectors)
111
 
112
  return recommendations_html
113
 
 
114
  # Create the Gradio interface
115
  with gr.Blocks(title="Steam Game Recommender") as demo:
116
  gr.Markdown("Steam Game Recommender")
117
  gr.Markdown("Enter a game you like and customize filters to get similar suggestions.")
118
 
119
  with gr.Row():
120
+ input_text = gr.Textbox(label="Input Steam Game")
121
 
122
  with gr.Row():
123
  max_age_slider = gr.Slider(0, 21, value=17, label="Max Age Rating (Avoid Adult Games)")
 
136
  outputs=output_text
137
  )
138
 
 
139
  # Launch the app
140
  if __name__ == "__main__":
141
  demo.launch()