Spaces:
Runtime error
Runtime error
Added dropdown
Browse files
app.py
CHANGED
|
@@ -17,6 +17,10 @@ print("Model downloaded")
|
|
| 17 |
|
| 18 |
def wine_quality(type, fixed_acidity, volatile_acidity, citric_acid, residual_sugar, chlorides, free_sulfur_dioxide, total_sulfur_dioxide, density, pH, sulphates, alcohol):
|
| 19 |
print("Calling function")
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
df = pd.DataFrame([[type, fixed_acidity, volatile_acidity, citric_acid, residual_sugar, chlorides, free_sulfur_dioxide, total_sulfur_dioxide, density, pH, sulphates, alcohol]],
|
| 21 |
columns=['type', 'fixed acidity', 'volatile acidity', 'citric acid', 'residual sugar', 'chlorides',])
|
| 22 |
print("Predicting")
|
|
@@ -34,7 +38,7 @@ demo = gr.Interface(
|
|
| 34 |
description="Predict the quality of wine based on its features.",
|
| 35 |
allow_flagging="never",
|
| 36 |
inputs=[
|
| 37 |
-
gr.
|
| 38 |
gr.inputs.Number(default=5.0, label="fixed acidity"),
|
| 39 |
gr.inputs.Number(default=5.0, label="volatile acidity"),
|
| 40 |
gr.inputs.Number(default=5.0, label="citric acid"),
|
|
|
|
| 17 |
|
| 18 |
def wine_quality(type, fixed_acidity, volatile_acidity, citric_acid, residual_sugar, chlorides, free_sulfur_dioxide, total_sulfur_dioxide, density, pH, sulphates, alcohol):
|
| 19 |
print("Calling function")
|
| 20 |
+
if(type == "red"):
|
| 21 |
+
type = 0
|
| 22 |
+
else:
|
| 23 |
+
type = 1
|
| 24 |
df = pd.DataFrame([[type, fixed_acidity, volatile_acidity, citric_acid, residual_sugar, chlorides, free_sulfur_dioxide, total_sulfur_dioxide, density, pH, sulphates, alcohol]],
|
| 25 |
columns=['type', 'fixed acidity', 'volatile acidity', 'citric acid', 'residual sugar', 'chlorides',])
|
| 26 |
print("Predicting")
|
|
|
|
| 38 |
description="Predict the quality of wine based on its features.",
|
| 39 |
allow_flagging="never",
|
| 40 |
inputs=[
|
| 41 |
+
gr.Dropdown(["red", "white"], label="type"),
|
| 42 |
gr.inputs.Number(default=5.0, label="fixed acidity"),
|
| 43 |
gr.inputs.Number(default=5.0, label="volatile acidity"),
|
| 44 |
gr.inputs.Number(default=5.0, label="citric acid"),
|