fatimag29 commited on
Commit
f6ca109
·
1 Parent(s): f3f08a5

Add application

Browse files
Files changed (1) hide show
  1. app.py +14 -3
app.py CHANGED
@@ -1,10 +1,21 @@
1
- # Import the necessary libraries
2
  import gradio as gr # Gradio is a library to quickly build and share demos for ML models
3
  import joblib # joblib is used here to load the trained model from a file
4
  import numpy as np # NumPy for numerical operations (if needed for array manipulation)
 
5
 
6
- # Load the pre-trained Decision Tree classifier from the joblib file
7
- pipeline = joblib.load("./models/iris_dt.joblib")
 
 
 
 
 
 
 
 
 
 
 
8
 
9
  # Define a function that takes the four iris measurements as input
10
  # and returns the predicted iris species label.
 
 
1
  import gradio as gr # Gradio is a library to quickly build and share demos for ML models
2
  import joblib # joblib is used here to load the trained model from a file
3
  import numpy as np # NumPy for numerical operations (if needed for array manipulation)
4
+ from huggingface_hub import hf_hub_download
5
 
6
+ HF_TOKEN = 'hf_your_token_here' # Replace with your actual Hugging Face token
7
+
8
+ # Replace with your actual Hugging Face model repo ID and file names
9
+ # For example, repo_id="username/iris-decision-tree"
10
+ # Use repo_type="model" if it's a model repository
11
+ model_path = hf_hub_download(
12
+ repo_id="brjapon/iris-dt",
13
+ filename="iris_dt.joblib", # The model file stored in the HF repo
14
+ repo_type="model" # Could also be 'dataset' if you're storing it that way
15
+ )
16
+
17
+ # Load the trained model
18
+ pipeline = joblib.load(model_path)
19
 
20
  # Define a function that takes the four iris measurements as input
21
  # and returns the predicted iris species label.