Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1418,6 +1418,14 @@ def predict_fraud_enhanced(file, threshold: float = 0.5):
|
|
| 1418 |
)
|
| 1419 |
|
| 1420 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1421 |
# Create Gradio Interface
|
| 1422 |
with gr.Blocks(
|
| 1423 |
title="Credit Card Fraud Detection",
|
|
|
|
| 1418 |
)
|
| 1419 |
|
| 1420 |
|
| 1421 |
+
# Apply GPU decorator to prediction function for ZeroGPU
|
| 1422 |
+
# This allows GPU to be allocated only during prediction calls, not for the entire server
|
| 1423 |
+
# ZeroGPU requires at least one @spaces.GPU decorated function to detect and allocate GPU
|
| 1424 |
+
if SPACES_AVAILABLE:
|
| 1425 |
+
print("Applying @spaces.GPU decorator to predict_fraud_enhanced for ZeroGPU support")
|
| 1426 |
+
predict_fraud_enhanced = spaces.GPU(predict_fraud_enhanced)
|
| 1427 |
+
|
| 1428 |
+
|
| 1429 |
# Create Gradio Interface
|
| 1430 |
with gr.Blocks(
|
| 1431 |
title="Credit Card Fraud Detection",
|