Update app.py
Browse files
app.py
CHANGED
|
@@ -104,7 +104,13 @@ def predict(fixed_acidity, volatile_acidity, citric_acid, residual_sugar,
|
|
| 104 |
|
| 105 |
# Make predictions
|
| 106 |
prediction = pipeline.predict(df)
|
| 107 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 108 |
|
| 109 |
# Define input components for Gradio
|
| 110 |
inputs = [
|
|
|
|
| 104 |
|
| 105 |
# Make predictions
|
| 106 |
prediction = pipeline.predict(df)
|
| 107 |
+
probabilities = pipeline.predict_proba(df)
|
| 108 |
+
# Prepare the result
|
| 109 |
+
result = {
|
| 110 |
+
"Predicted Quality": int(prediction[0]), # Convert NumPy value to a Python int
|
| 111 |
+
"Class Probabilities": {str(i): prob for i, prob in enumerate(probabilities[0])}
|
| 112 |
+
}
|
| 113 |
+
return result
|
| 114 |
|
| 115 |
# Define input components for Gradio
|
| 116 |
inputs = [
|