kedimestan commited on
Commit
f74bd02
·
verified ·
1 Parent(s): 87c2437

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -3
app.py CHANGED
@@ -1,11 +1,13 @@
1
  import gradio as gr
2
  import joblib
3
  import numpy as np
 
 
4
 
5
- # Load the RandomForest model
6
  model = joblib.load('random_forest_model.pkl') # Update with the actual path
 
7
  # Define a function for classification
8
- def classify(features):
9
  # Convert the input features to a 2D numpy array
10
  features_array = np.array([features])
11
  # Make a prediction
@@ -16,7 +18,7 @@ def classify(features):
16
  iface = gr.Interface(
17
  fn=classify,
18
  inputs=[
19
- gr.Slider(minimum=0, maximum=100, default=50, label=f"Feature {i+1}") for i in range(15)
20
  ],
21
  outputs="text",
22
  title="Age Classification",
@@ -25,3 +27,4 @@ iface = gr.Interface(
25
 
26
  # Launch the interface
27
  iface.launch()
 
 
1
  import gradio as gr
2
  import joblib
3
  import numpy as np
4
+ import sklearn
5
+
6
 
 
7
  model = joblib.load('random_forest_model.pkl') # Update with the actual path
8
+
9
  # Define a function for classification
10
+ def classify(*features):
11
  # Convert the input features to a 2D numpy array
12
  features_array = np.array([features])
13
  # Make a prediction
 
18
  iface = gr.Interface(
19
  fn=classify,
20
  inputs=[
21
+ gr.Slider(minimum=0, maximum=100, value=50, label=f"Feature {i+1}") for i in range(15)
22
  ],
23
  outputs="text",
24
  title="Age Classification",
 
27
 
28
  # Launch the interface
29
  iface.launch()
30
+