soni0391s commited on
Commit
fa3f863
·
verified ·
1 Parent(s): 9fcb04d

Upload 3 files

Browse files
Files changed (3) hide show
  1. app.py +31 -0
  2. game_model.joblib +3 -0
  3. scaler.joblib +3 -0
app.py ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import joblib
3
+ import numpy as np
4
+
5
+ # Load trained model and scaler
6
+ model = joblib.load("game_model.joblib")
7
+ scaler = joblib.load("scaler.joblib")
8
+
9
+ # Prediction function
10
+ def predict_sales(na, eu, jp, other, year):
11
+ X = np.array([[na, eu, jp, other, year]])
12
+ X_scaled = scaler.transform(X)
13
+ pred = model.predict(X_scaled)[0]
14
+ return float(pred)
15
+
16
+ # Gradio UI
17
+ interface = gr.Interface(
18
+ fn=predict_sales,
19
+ inputs=[
20
+ gr.Number(label="NA Sales"),
21
+ gr.Number(label="EU Sales"),
22
+ gr.Number(label="JP Sales"),
23
+ gr.Number(label="Other Sales"),
24
+ gr.Number(label="Year")
25
+ ],
26
+ outputs=gr.Number(label="Predicted Global Sales"),
27
+ title="Game Sales Predictor (KNN Model)",
28
+ description="Enter sales values to predict the total global sales of a game."
29
+ )
30
+
31
+ interface.launch()
game_model.joblib ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b29b8742d47e02514c445c2cb47d883c08f42a10f5ed017f4b270634eb8d6709
3
+ size 17446
scaler.joblib ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a6338b39b677b3f01ffd056c485259827893aaf1b999495b84996a99a9c1775d
3
+ size 1023