Changed the limit on get_cards() to optional
Browse files- app/main.py +1 -1
- app/services/similarity_service.py +1 -1
app/main.py
CHANGED
|
@@ -83,7 +83,7 @@ async def predict(file: UploadFile = File(...)):
|
|
| 83 |
|
| 84 |
# Endpoint to display a sample of cards in the database
|
| 85 |
@app.get("/cards")
|
| 86 |
-
def get_cards(limit: int =
|
| 87 |
try:
|
| 88 |
cards = app.state.similarity_service.get_all_cards(limit=limit)
|
| 89 |
return cards
|
|
|
|
| 83 |
|
| 84 |
# Endpoint to display a sample of cards in the database
|
| 85 |
@app.get("/cards")
|
| 86 |
+
def get_cards(limit: int | None = None):
|
| 87 |
try:
|
| 88 |
cards = app.state.similarity_service.get_all_cards(limit=limit)
|
| 89 |
return cards
|
app/services/similarity_service.py
CHANGED
|
@@ -47,7 +47,7 @@ class SimilarityService:
|
|
| 47 |
|
| 48 |
return results
|
| 49 |
|
| 50 |
-
def get_all_cards(self, limit: int =
|
| 51 |
# Check if metadat is a dictionary
|
| 52 |
if isinstance(self.metadata, dict):
|
| 53 |
# Return metadata values
|
|
|
|
| 47 |
|
| 48 |
return results
|
| 49 |
|
| 50 |
+
def get_all_cards(self, limit: int | None = None) -> list[dict]:
|
| 51 |
# Check if metadat is a dictionary
|
| 52 |
if isinstance(self.metadata, dict):
|
| 53 |
# Return metadata values
|