ositamiles commited on
Commit
092cd6c
·
verified ·
1 Parent(s): 53f41ef

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -12
app.py CHANGED
@@ -257,27 +257,22 @@ elif page == "Price Prediction":
257
  past_sales = st.slider("Past Sales", 100, 1000, 500)
258
 
259
  # Prepare input for prediction
260
- input_data = np.array([[
261
  le_genre.transform([genre])[0],
262
  le_region.transform([region])[0],
263
  demand_index,
264
  competitor_price,
265
  past_sales
266
- ]])
267
 
268
- input_scaled = scaler.transform(input_data)
269
- input_reshaped = input_scaled.reshape((1, 1, input_scaled.shape[1]))
270
 
271
  # Make predictions
272
  if st.button("Predict Price"):
273
- lstm_price = lstm_model.predict(input_reshaped)[0][0]
274
- transformer_price = transformer_model.predict(input_reshaped)[0][0]
275
- rl_price = rl_model.predict(input_scaled)[0][0]
276
-
277
- # Get LLM analysis
278
- game_info = f"Genre: {genre}, Region: {region}, Past Sales: {past_sales}"
279
- market_info = f"Demand Index: {demand_index}, Competitor Price: {competitor_price}"
280
- llm_analysis = get_llm_analysis(game_info, market_info)
281
 
282
  # Display results
283
  st.success(f"LSTM Predicted Price: ${lstm_price:.2f}")
 
257
  past_sales = st.slider("Past Sales", 100, 1000, 500)
258
 
259
  # Prepare input for prediction
260
+ input_data = np.array([
261
  le_genre.transform([genre])[0],
262
  le_region.transform([region])[0],
263
  demand_index,
264
  competitor_price,
265
  past_sales
266
+ ])
267
 
268
+ input_scaled = scaler.transform(input_data.reshape(1, -1)).flatten()
269
+ input_with_step = np.append(input_scaled, 0) # Add a step value (0 for prediction)
270
 
271
  # Make predictions
272
  if st.button("Predict Price"):
273
+ lstm_price = lstm_model.predict(input_scaled.reshape(1, 1, -1))[0][0]
274
+ transformer_price = transformer_model.predict(input_scaled.reshape(1, 1, -1))[0][0]
275
+ rl_price = rl_model.predict(input_with_step)[0]
 
 
 
 
 
276
 
277
  # Display results
278
  st.success(f"LSTM Predicted Price: ${lstm_price:.2f}")