Update routes/dem_pyc_hoan_thanh.py
Browse files- routes/dem_pyc_hoan_thanh.py +12 -2
routes/dem_pyc_hoan_thanh.py
CHANGED
|
@@ -1,4 +1,14 @@
|
|
| 1 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
def dem_pyc_hoan_thanh():
|
| 3 |
try:
|
| 4 |
all_files = list_repo_files(repo_id=REPO_ID, repo_type="dataset", token=HF_TOKEN)
|
|
@@ -7,7 +17,7 @@ def dem_pyc_hoan_thanh():
|
|
| 7 |
f for f in all_files
|
| 8 |
if f.startswith("Khach_hang/")
|
| 9 |
and "/Scan/" in f
|
| 10 |
-
and "GCN" in f.upper() #
|
| 11 |
]
|
| 12 |
|
| 13 |
thong_ke = defaultdict(list)
|
|
|
|
| 1 |
+
from fastapi import APIRouter
|
| 2 |
+
from huggingface_hub import list_repo_files
|
| 3 |
+
from collections import defaultdict
|
| 4 |
+
import os
|
| 5 |
+
|
| 6 |
+
router = APIRouter()
|
| 7 |
+
|
| 8 |
+
REPO_ID = "doluong6/Quatest1"
|
| 9 |
+
HF_TOKEN = os.environ.get("HF_TOKEN")
|
| 10 |
+
|
| 11 |
+
@router.get("/dem_pyc_hoan_thanh")
|
| 12 |
def dem_pyc_hoan_thanh():
|
| 13 |
try:
|
| 14 |
all_files = list_repo_files(repo_id=REPO_ID, repo_type="dataset", token=HF_TOKEN)
|
|
|
|
| 17 |
f for f in all_files
|
| 18 |
if f.startswith("Khach_hang/")
|
| 19 |
and "/Scan/" in f
|
| 20 |
+
and "GCN" in os.path.basename(f).upper() # kiểm tra tên file chứa "GCN"
|
| 21 |
]
|
| 22 |
|
| 23 |
thong_ke = defaultdict(list)
|