Spaces:
Sleeping
Sleeping
Zwea Htet
commited on
Commit
·
66bfc6b
1
Parent(s):
9fb0f7d
added huggingface api
Browse files- models/vector_database.py +12 -2
models/vector_database.py
CHANGED
|
@@ -8,7 +8,7 @@ from llama_index.core import (
|
|
| 8 |
VectorStoreIndex,
|
| 9 |
StorageContext,
|
| 10 |
)
|
| 11 |
-
from huggingface_hub import HfFileSystem
|
| 12 |
|
| 13 |
import os
|
| 14 |
|
|
@@ -70,4 +70,14 @@ def get_pinecone_index(filename: str) -> VectorStoreIndex:
|
|
| 70 |
documents=docs, show_progress=True, storage_context=storage_context
|
| 71 |
)
|
| 72 |
|
| 73 |
-
return index
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
VectorStoreIndex,
|
| 9 |
StorageContext,
|
| 10 |
)
|
| 11 |
+
from huggingface_hub import HfFileSystem, HfApi
|
| 12 |
|
| 13 |
import os
|
| 14 |
|
|
|
|
| 70 |
documents=docs, show_progress=True, storage_context=storage_context
|
| 71 |
)
|
| 72 |
|
| 73 |
+
return index
|
| 74 |
+
|
| 75 |
+
api = HfApi(
|
| 76 |
+
token=os.environ.get("HF_TOKEN")
|
| 77 |
+
)
|
| 78 |
+
|
| 79 |
+
api.upload_file(
|
| 80 |
+
repo_id="hbui/RegBot4.0",
|
| 81 |
+
path_or_fileobj=f"{SAVE_DIR}/calregs.pdf",
|
| 82 |
+
path_in_repo=f"{SAVE_DIR}/calregs.pdf",
|
| 83 |
+
)
|