Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
@@ -8,6 +8,13 @@ from langchain.chains import RetrievalQA
|
|
8 |
from langchain_community.llms import HuggingFacePipeline
|
9 |
from transformers import pipeline, AutoTokenizer
|
10 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
def load_documents(file_path="study_materials"):
|
12 |
documents = []
|
13 |
for filename in os.listdir(file_path):
|
|
|
8 |
from langchain_community.llms import HuggingFacePipeline
|
9 |
from transformers import pipeline, AutoTokenizer
|
10 |
|
11 |
+
# Optional but recommended addition
|
12 |
+
from huggingface_hub import login
|
13 |
+
import os
|
14 |
+
|
15 |
+
if os.environ.get("HF_TOKEN"):
|
16 |
+
login(token=os.environ["HF_TOKEN"]) # No hardcoded tokens!
|
17 |
+
|
18 |
def load_documents(file_path="study_materials"):
|
19 |
documents = []
|
20 |
for filename in os.listdir(file_path):
|