|
import gradio as gr |
|
from PIL import Image |
|
import requests |
|
import hopsworks |
|
import joblib |
|
import pandas as pd |
|
|
|
|
|
|
|
|
|
|
|
|
|
def wine_quality(wine_type, fixed_acidity, volatile_acidity, citric_acid, residual_sugar, chlorides, |
|
free_sulfur_dioxide, total_sulfur_dioxide, density, ph, sulphates, alcohol): |
|
print("Calling wine_quality() function") |
|
df = pd.DataFrame([[fixed_acidity, volatile_acidity, citric_acid, residual_sugar, chlorides, |
|
free_sulfur_dioxide, total_sulfur_dioxide, density, ph, sulphates, alcohol]], |
|
columns=['fixed_acidity', 'volatile_acidity', 'citric_acid', 'residual_sugar', |
|
'chlorides', 'free_sulfur_dioxide', 'total_sulfur_dioxide', 'density', |
|
'ph', 'sulphates', 'alcohol']) |
|
print("Predicting...") |
|
print(df) |
|
|
|
|
|
if wine_type == 'Red': |
|
|
|
|
|
quality = "Red Wine Quality Prediction Placeholder" |
|
else: |
|
|
|
|
|
quality = "White Wine Quality Prediction Placeholder" |
|
|
|
return quality |
|
|
|
|
|
|
|
iface = gr.Interface(fn=wine_quality, |
|
inputs=["dropdown", "number", "number", "number", "number", "number", |
|
"number", "number", "number", "number", "number", "number"], |
|
outputs="text", |
|
examples=[['Red', 7.4, 0.70, 0.00, 1.9, 0.076, 11.0, 34.0, 0.9978, 3.51, 0.56, 9.4], |
|
['White', 7.0, 0.27, 0.36, 20.7, 0.045, 45.0, 170.0, 1.0010, 3.00, 0.45, 8.8]]) |
|
|
|
iface.launch() |
|
|