Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
Commit
•
a8c1b79
1
Parent(s):
3408aae
rename function
Browse files- load_card_data.py +2 -2
- main.py +2 -2
load_card_data.py
CHANGED
@@ -185,7 +185,7 @@ def get_inference_client():
|
|
185 |
)
|
186 |
|
187 |
|
188 |
-
def
|
189 |
logger.info(f"Starting data refresh with min_len={min_len}, min_likes={min_likes}")
|
190 |
chroma_client = get_chroma_client()
|
191 |
embedding_function = get_embedding_function()
|
@@ -216,4 +216,4 @@ def _create_and_upsert_embeddings(data, collection):
|
|
216 |
|
217 |
|
218 |
if __name__ == "__main__":
|
219 |
-
|
|
|
185 |
)
|
186 |
|
187 |
|
188 |
+
def refresh_card_data(min_len: int = 200, min_likes: Optional[int] = None):
|
189 |
logger.info(f"Starting data refresh with min_len={min_len}, min_likes={min_likes}")
|
190 |
chroma_client = get_chroma_client()
|
191 |
embedding_function = get_embedding_function()
|
|
|
216 |
|
217 |
|
218 |
if __name__ == "__main__":
|
219 |
+
refresh_card_data()
|
main.py
CHANGED
@@ -15,7 +15,7 @@ from starlette.status import (
|
|
15 |
HTTP_403_FORBIDDEN,
|
16 |
)
|
17 |
|
18 |
-
from load_card_data import get_embedding_function, get_save_path,
|
19 |
|
20 |
# Set up logging
|
21 |
logging.basicConfig(
|
@@ -50,7 +50,7 @@ async def lifespan(app: FastAPI):
|
|
50 |
logger.info("Collection initialized successfully")
|
51 |
|
52 |
# Refresh data
|
53 |
-
|
54 |
logger.info("Data refresh completed successfully")
|
55 |
except Exception as e:
|
56 |
logger.error(f"Error during startup: {str(e)}")
|
|
|
15 |
HTTP_403_FORBIDDEN,
|
16 |
)
|
17 |
|
18 |
+
from load_card_data import get_embedding_function, get_save_path, refresh_card_data
|
19 |
|
20 |
# Set up logging
|
21 |
logging.basicConfig(
|
|
|
50 |
logger.info("Collection initialized successfully")
|
51 |
|
52 |
# Refresh data
|
53 |
+
refresh_card_data()
|
54 |
logger.info("Data refresh completed successfully")
|
55 |
except Exception as e:
|
56 |
logger.error(f"Error during startup: {str(e)}")
|