Spaces:
Sleeping
Sleeping
Commit
·
e707850
1
Parent(s):
f186737
returned to customer logger
Browse files
main.py
CHANGED
|
@@ -30,7 +30,13 @@ query_queue: asyncio.Queue = asyncio.Queue()
|
|
| 30 |
results: dict[str, dict] = {}
|
| 31 |
classifier = None # will be initialized in lifespan
|
| 32 |
|
| 33 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 34 |
logger.info("Starting the application...")
|
| 35 |
logger.info(f"Using model: {MODEL_NAME}")
|
| 36 |
logger.info(f"Batch process interval: {BATCH_PROCESS_INTERVAL}")
|
|
@@ -118,8 +124,7 @@ app = FastAPI(lifespan=lifespan)
|
|
| 118 |
# ----------------------------- #
|
| 119 |
@app.post("/classify")
|
| 120 |
async def classify(query: Query):
|
| 121 |
-
|
| 122 |
-
logger.info(f"Received query at: {query_time.isoformat()}")
|
| 123 |
query_id = str(uuid.uuid4())
|
| 124 |
await query_queue.put({"id": query_id, "sentence": query.sentence})
|
| 125 |
|
|
|
|
| 30 |
results: dict[str, dict] = {}
|
| 31 |
classifier = None # will be initialized in lifespan
|
| 32 |
|
| 33 |
+
logging.basicConfig(
|
| 34 |
+
level=logging.INFO,
|
| 35 |
+
format="%(asctime)s - %(name)s - %(levelname)s - %(message)s",
|
| 36 |
+
datefmt="%Y-%m-%d %H:%M:%S",
|
| 37 |
+
)
|
| 38 |
+
|
| 39 |
+
logger = logging.getLogger(__name__)
|
| 40 |
logger.info("Starting the application...")
|
| 41 |
logger.info(f"Using model: {MODEL_NAME}")
|
| 42 |
logger.info(f"Batch process interval: {BATCH_PROCESS_INTERVAL}")
|
|
|
|
| 124 |
# ----------------------------- #
|
| 125 |
@app.post("/classify")
|
| 126 |
async def classify(query: Query):
|
| 127 |
+
logger.info(f"{query.sentence}")
|
|
|
|
| 128 |
query_id = str(uuid.uuid4())
|
| 129 |
await query_queue.put({"id": query_id, "sentence": query.sentence})
|
| 130 |
|