Spaces:
Runtime error
Runtime error
Commit ·
fba0a01
1
Parent(s): 05bf721
Update JSON structure: Remove winner field, rename fields, add new prediction metrics
Browse files
app.py
CHANGED
|
@@ -934,12 +934,13 @@ def predict_single(control_image, variant_image, business_model, customer_type,
|
|
| 934 |
|
| 935 |
# Create enhanced output with confidence scores and training data info
|
| 936 |
result = {
|
| 937 |
-
"winner": winner,
|
| 938 |
"probability": f"{probability:.3f}",
|
| 939 |
-
"
|
| 940 |
-
"
|
| 941 |
-
"
|
| 942 |
-
"
|
|
|
|
|
|
|
| 943 |
}
|
| 944 |
|
| 945 |
print(f"🎯 Final result: {result}")
|
|
@@ -954,10 +955,12 @@ def predict_single(control_image, variant_image, business_model, customer_type,
|
|
| 954 |
# Return error result with fallback confidence data
|
| 955 |
return {
|
| 956 |
"error": f"Prediction failed: {str(e)}",
|
| 957 |
-
"
|
| 958 |
-
"
|
| 959 |
-
"
|
| 960 |
-
"
|
|
|
|
|
|
|
| 961 |
}
|
| 962 |
|
| 963 |
@spaces.GPU
|
|
|
|
| 934 |
|
| 935 |
# Create enhanced output with confidence scores and training data info
|
| 936 |
result = {
|
|
|
|
| 937 |
"probability": f"{probability:.3f}",
|
| 938 |
+
"mobileConfidence": f"{confidence_percentage:.1f}%",
|
| 939 |
+
"trainingDataSamples": confidence_data['training_data_count'],
|
| 940 |
+
"totalPredictions": confidence_data['count'],
|
| 941 |
+
"correctPredictions": confidence_data['correct_predictions'],
|
| 942 |
+
"totalWinsPrediction": confidence_data['actual_wins'],
|
| 943 |
+
"totalLosePrediction": confidence_data['count'] - confidence_data['actual_wins']
|
| 944 |
}
|
| 945 |
|
| 946 |
print(f"🎯 Final result: {result}")
|
|
|
|
| 955 |
# Return error result with fallback confidence data
|
| 956 |
return {
|
| 957 |
"error": f"Prediction failed: {str(e)}",
|
| 958 |
+
"mobileConfidence": "50.0%",
|
| 959 |
+
"trainingDataSamples": 0,
|
| 960 |
+
"totalPredictions": 0,
|
| 961 |
+
"correctPredictions": 0,
|
| 962 |
+
"totalWinsPrediction": 0,
|
| 963 |
+
"totalLosePrediction": 0
|
| 964 |
}
|
| 965 |
|
| 966 |
@spaces.GPU
|