dcorcoran commited on
Commit
c46132a
·
1 Parent(s): a7d7ac4

Changed the limit on get_cards() to optional

Browse files
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 = 100):
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 = 100) -> list[dict]:
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