jackenmail commited on
Commit
d766334
·
verified ·
1 Parent(s): d7f6ff1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -4
app.py CHANGED
@@ -1,17 +1,25 @@
1
  import joblib
2
  import gradio as gr
 
3
 
4
  # Load model
5
  model = joblib.load("./scaler.pkl")
6
 
7
  # Prediction function
8
  def predict(val1, val2):
9
- prediction = model.predict([[float(val1), float(val2)]])
10
- return str(prediction[0])
 
 
 
 
11
 
12
  # UI
13
  gr.Interface(
14
  fn=predict,
15
- inputs=["number", "number"],
 
 
 
16
  outputs="text"
17
- ).launch()
 
1
  import joblib
2
  import gradio as gr
3
+ import numpy as np
4
 
5
  # Load model
6
  model = joblib.load("./scaler.pkl")
7
 
8
  # Prediction function
9
  def predict(val1, val2):
10
+ try:
11
+ data = np.array([[float(val1), float(val2)]])
12
+ prediction = model.predict(data)
13
+ return str(prediction[0])
14
+ except Exception as e:
15
+ return f"Error: {str(e)}"
16
 
17
  # UI
18
  gr.Interface(
19
  fn=predict,
20
+ inputs=[
21
+ gr.Number(label="CGPA"),
22
+ gr.Number(label="IQ")
23
+ ],
24
  outputs="text"
25
+ ).launch()