Phase 7: Hoàn thiện Modular RAG Backend với FastAPI và Đa LLM Provider
This commit is contained in:
26
scratch/get_drive.py
Normal file
26
scratch/get_drive.py
Normal file
@@ -0,0 +1,26 @@
|
||||
import logging
|
||||
import json
|
||||
from ingestion.graph_client import GraphClient
|
||||
|
||||
logging.basicConfig(level=logging.INFO)
|
||||
|
||||
def get_real_drive_id():
|
||||
client = GraphClient()
|
||||
try:
|
||||
site = client.get_site_by_path("285pdg.sharepoint.com", "/sites/poc_system")
|
||||
site_id = site["id"]
|
||||
print(f"Site ID: {site_id}")
|
||||
|
||||
drive = client.get_drive(site_id)
|
||||
drive_id = drive["id"]
|
||||
print(f"Drive ID: {drive_id}")
|
||||
|
||||
# Write the correct drive ID to a file so we know what it is
|
||||
with open("correct_drive_id.txt", "w") as f:
|
||||
f.write(drive_id)
|
||||
|
||||
except Exception as e:
|
||||
print(f"Error: {e}")
|
||||
|
||||
if __name__ == "__main__":
|
||||
get_real_drive_id()
|
||||
12
scratch/test_item.py
Normal file
12
scratch/test_item.py
Normal file
@@ -0,0 +1,12 @@
|
||||
import os
|
||||
import sys
|
||||
import json
|
||||
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
||||
from ingestion.graph_client import GraphClient
|
||||
|
||||
client = GraphClient()
|
||||
drive_id = "b!15GOzaN4pU2LRNmRYc8vat7d48GJXyJBj-eKaLgrGv9svCswiraBQalAnVnRMl79"
|
||||
item_id = "01BP532D2O74Z6FYQPOVBKE5DBMYDWCWCK"
|
||||
url = f"https://graph.microsoft.com/v1.0/drives/{drive_id}/items/{item_id}"
|
||||
resp = client._make_request("GET", url)
|
||||
print(json.dumps(resp, indent=2))
|
||||
14
scratch/test_paddle.py
Normal file
14
scratch/test_paddle.py
Normal file
@@ -0,0 +1,14 @@
|
||||
import cv2
|
||||
import numpy as np
|
||||
from paddleocr import PaddleOCR
|
||||
|
||||
# Create a dummy image with some text
|
||||
img = np.zeros((100, 300, 3), dtype=np.uint8)
|
||||
cv2.putText(img, "Hello World", (10, 50), cv2.FONT_HERSHEY_SIMPLEX, 1, (255, 255, 255), 2)
|
||||
|
||||
ocr = PaddleOCR(use_angle_cls=False, lang="vi", enable_mkldnn=False)
|
||||
result = ocr.ocr(img)
|
||||
|
||||
print("===== RAW RESULT =====")
|
||||
print(result)
|
||||
print("======================")
|
||||
Reference in New Issue
Block a user