Spaces:
Paused
Paused
add timestamp when seach occured and search time in logging
Browse files
app.py
CHANGED
|
@@ -1,6 +1,5 @@
|
|
| 1 |
-
import os
|
| 2 |
-
import
|
| 3 |
-
import subprocess
|
| 4 |
from fastapi import FastAPI
|
| 5 |
|
| 6 |
from langchain_community.vectorstores import Chroma
|
|
@@ -71,9 +70,15 @@ def rag_with_reranking(query : str):
|
|
| 71 |
def search_text(query):
|
| 72 |
"""Searches for similar texts."""
|
| 73 |
|
|
|
|
|
|
|
|
|
|
| 74 |
print(f"Searching for: {query}")
|
| 75 |
|
|
|
|
| 76 |
results = rag_with_reranking(query)
|
|
|
|
|
|
|
| 77 |
|
| 78 |
lst = []
|
| 79 |
for doc in results:
|
|
|
|
| 1 |
+
import os, subprocess, time, pytz
|
| 2 |
+
from datetime import datetime
|
|
|
|
| 3 |
from fastapi import FastAPI
|
| 4 |
|
| 5 |
from langchain_community.vectorstores import Chroma
|
|
|
|
| 70 |
def search_text(query):
|
| 71 |
"""Searches for similar texts."""
|
| 72 |
|
| 73 |
+
tz = pytz.timezone('Asia/Bangkok') # GMT+7
|
| 74 |
+
now = datetime.now(tz)
|
| 75 |
+
print(f"{now.strftime('%Y-%m-%d %H:%M:%S')}")
|
| 76 |
print(f"Searching for: {query}")
|
| 77 |
|
| 78 |
+
start = time.time()
|
| 79 |
results = rag_with_reranking(query)
|
| 80 |
+
end = time.time()
|
| 81 |
+
print("Search Time:", end - start, "seconds")
|
| 82 |
|
| 83 |
lst = []
|
| 84 |
for doc in results:
|