Spaces:
Sleeping
Sleeping
Add ZeroGPU decorator
Browse files
app.py
CHANGED
|
@@ -13,7 +13,10 @@ classifier = pipeline(
|
|
| 13 |
image_processor="model",
|
| 14 |
)
|
| 15 |
|
|
|
|
| 16 |
|
|
|
|
|
|
|
| 17 |
def predict(image):
|
| 18 |
results = classifier(image, top_k=3)
|
| 19 |
return {item["label"]: item["score"] for item in results}
|
|
|
|
| 13 |
image_processor="model",
|
| 14 |
)
|
| 15 |
|
| 16 |
+
gpu = spaces.GPU if spaces else lambda fn: fn
|
| 17 |
|
| 18 |
+
|
| 19 |
+
@gpu
|
| 20 |
def predict(image):
|
| 21 |
results = classifier(image, top_k=3)
|
| 22 |
return {item["label"]: item["score"] for item in results}
|