Cargando app
Browse files
app.py
CHANGED
@@ -2,9 +2,21 @@
|
|
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 |
-
|
7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
|
9 |
# Define a function that takes the four iris measurements as input
|
10 |
# and returns the predicted iris species label.
|
@@ -49,4 +61,4 @@ if __name__ == "__main__":
|
|
49 |
# a particular input-output interaction for later review.
|
50 |
# When someone clicks Flag, Gradio saves the input values (and often the output) to a log.csv file
|
51 |
# letting you keep track of interesting or potentially problematic cases for debugging or analysis later on
|
52 |
-
'''
|
|
|
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 |
+
from huggingface_hub import hf_hub_download
|
6 |
|
7 |
+
HF_TOKEN = 'hf_your_token_here' # Replace with your actual Hugging Face token
|
8 |
+
|
9 |
+
# Replace with your actual Hugging Face model repo ID and file names
|
10 |
+
# For example, repo_id="username/iris-decision-tree"
|
11 |
+
# Use repo_type="model" if it's a model repository
|
12 |
+
model_path = hf_hub_download(
|
13 |
+
repo_id="brjapon/iris-dt",
|
14 |
+
filename="iris_dt.joblib", # The model file stored in the HF repo
|
15 |
+
repo_type="model" # Could also be 'dataset' if you're storing it that way
|
16 |
+
)
|
17 |
+
|
18 |
+
# Load the trained model
|
19 |
+
pipeline = joblib.load(model_path)
|
20 |
|
21 |
# Define a function that takes the four iris measurements as input
|
22 |
# and returns the predicted iris species label.
|
|
|
61 |
# a particular input-output interaction for later review.
|
62 |
# When someone clicks Flag, Gradio saves the input values (and often the output) to a log.csv file
|
63 |
# letting you keep track of interesting or potentially problematic cases for debugging or analysis later on
|
64 |
+
'''
|