shahad23 commited on
Commit
dae226f
·
verified ·
1 Parent(s): 1251c12

Upload IrisModel.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. IrisModel.py +23 -0
IrisModel.py ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ import gradio as gr
3
+ import pickle
4
+ import numpy as np
5
+
6
+ # Load the trained model
7
+ with open('model.pkl', 'rb') as f:
8
+ model = pickle.load(f)
9
+
10
+ def predict(sepal_length, sepal_width, petal_length, petal_width):
11
+ input_data = np.array([[sepal_length, sepal_width, petal_length, petal_width]])
12
+ prediction = model.predict(input_data)
13
+ return prediction[0]
14
+
15
+ interface = gr.Interface(
16
+ fn=predict,
17
+ inputs=["number", "number", "number", "number"],
18
+ outputs="text",
19
+ title="Iris Flower Classifier",
20
+ description="Enter the features of the iris flower to predict its species."
21
+ )
22
+
23
+ interface.launch()