Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -11,10 +11,8 @@ from fastapi.middleware.cors import CORSMiddleware
|
|
| 11 |
from datetime import datetime
|
| 12 |
import pytz
|
| 13 |
|
| 14 |
-
# Lấy múi giờ Việt Nam
|
| 15 |
vietnam_tz = pytz.timezone("Asia/Ho_Chi_Minh")
|
| 16 |
|
| 17 |
-
# Lấy thời gian hiện tại ở Việt Nam
|
| 18 |
now_vietnam = datetime.now(vietnam_tz)
|
| 19 |
|
| 20 |
df = load_data()
|
|
@@ -24,7 +22,7 @@ print("-> Done")
|
|
| 24 |
|
| 25 |
def reload_data():
|
| 26 |
global df
|
| 27 |
-
now_vietnam = datetime.now(vietnam_tz).strftime("%Y-%m-%d %H:%M:%S")
|
| 28 |
print(f"[{now_vietnam}] Reloading data...")
|
| 29 |
df = load_data()
|
| 30 |
print(f"-> Done | Update: df_shape = {df.shape}")
|
|
@@ -73,9 +71,9 @@ def main():
|
|
| 73 |
print("FQA AI exit!")
|
| 74 |
return
|
| 75 |
print("Finding examples....", end="")
|
| 76 |
-
examples = find_similar_examples(q, df,
|
| 77 |
print("-> Done\nSolving...", end="")
|
| 78 |
-
|
| 79 |
user_prompt = user_prompt_for(q, examples)
|
| 80 |
result = llm_request(system_prompt, user_prompt)
|
| 81 |
print("-> Done")
|
|
|
|
| 11 |
from datetime import datetime
|
| 12 |
import pytz
|
| 13 |
|
|
|
|
| 14 |
vietnam_tz = pytz.timezone("Asia/Ho_Chi_Minh")
|
| 15 |
|
|
|
|
| 16 |
now_vietnam = datetime.now(vietnam_tz)
|
| 17 |
|
| 18 |
df = load_data()
|
|
|
|
| 22 |
|
| 23 |
def reload_data():
|
| 24 |
global df
|
| 25 |
+
now_vietnam = datetime.now(vietnam_tz).strftime("%Y-%m-%d %H:%M:%S")
|
| 26 |
print(f"[{now_vietnam}] Reloading data...")
|
| 27 |
df = load_data()
|
| 28 |
print(f"-> Done | Update: df_shape = {df.shape}")
|
|
|
|
| 71 |
print("FQA AI exit!")
|
| 72 |
return
|
| 73 |
print("Finding examples....", end="")
|
| 74 |
+
examples = find_similar_examples(q, df, 8)
|
| 75 |
print("-> Done\nSolving...", end="")
|
| 76 |
+
print(examples)
|
| 77 |
user_prompt = user_prompt_for(q, examples)
|
| 78 |
result = llm_request(system_prompt, user_prompt)
|
| 79 |
print("-> Done")
|