Spaces:
Build error
Build error
import gradio as gr | |
from sklearn.hub import HubLoader | |
hub = HubLoader("risingodegua/wine-quality-model", "sklearn_model.joblib") | |
model = hub.load() | |
def wine_quality_predictor(X): | |
'''Predicts the quality of wine | |
Parameters | |
---------- | |
X : numpy, list | |
A list containing values used for prediction. | |
Returns | |
------- | |
List | |
The list of predicted values. | |
''' | |
return model.predict(X.to_numpy()) | |
headers = [ | |
"fixed acidity", | |
"volatile acidity", | |
"citric acid", | |
"residual sugar", | |
"chlorides", | |
"free sulfur dioxide", | |
"total sulfur dioxide", | |
"density", | |
"pH", | |
"sulphates", | |
"alcohol", | |
] | |
default = [ | |
[7.4, 0.7, 0, 1.9, 0.076, 11, 34, 0.9978, 3.51, 0.56, 9.4], | |
[7.8, 0.88, 0, 2.6, 0.098, 25, 67, 0.9968, 3.2, 0.68, 9.8], | |
[7.8, 0.76, 0.04, 2.3, 0.092, 15, 54, 0.997, 3.26, 0.65, 9.8], | |
] | |
iface = gr.Interface( | |
wine_quality_predictor, | |
gr.inputs.Dataframe( | |
headers=headers, | |
default=default, | |
), | |
["numpy"], | |
description="Enter wine properties for prediction" | |
) | |
iface.launch() | |