Spaces:
Sleeping
Sleeping
Update app.py
Browse filesadded: client_kwargs={
"max_retries": 3,
"timeout": 30
}
app.py
CHANGED
|
@@ -16,15 +16,21 @@ from langchain_classic.chains import RetrievalQA
|
|
| 16 |
|
| 17 |
# 1. LLM SETUP (Using Granite via HF API)
|
| 18 |
def get_llm():
|
| 19 |
-
|
|
|
|
|
|
|
| 20 |
repo_id="ibm-granite/granite-3.1-8b-instruct",
|
| 21 |
task="text-generation",
|
| 22 |
max_new_tokens=512,
|
| 23 |
temperature=0.1,
|
| 24 |
-
huggingfacehub_api_token=
|
| 25 |
-
|
| 26 |
-
|
|
|
|
|
|
|
|
|
|
| 27 |
)
|
|
|
|
| 28 |
|
| 29 |
# 2. DOCUMENT PROCESSING
|
| 30 |
def process_pdf(file_path):
|
|
|
|
| 16 |
|
| 17 |
# 1. LLM SETUP (Using Granite via HF API)
|
| 18 |
def get_llm():
|
| 19 |
+
token = os.getenv("HF_TOKEN")
|
| 20 |
+
|
| 21 |
+
llm = HuggingFaceEndpoint(
|
| 22 |
repo_id="ibm-granite/granite-3.1-8b-instruct",
|
| 23 |
task="text-generation",
|
| 24 |
max_new_tokens=512,
|
| 25 |
temperature=0.1,
|
| 26 |
+
huggingfacehub_api_token=token,
|
| 27 |
+
|
| 28 |
+
client_kwargs={
|
| 29 |
+
"max_retries": 3,
|
| 30 |
+
"timeout": 30
|
| 31 |
+
}
|
| 32 |
)
|
| 33 |
+
return llm
|
| 34 |
|
| 35 |
# 2. DOCUMENT PROCESSING
|
| 36 |
def process_pdf(file_path):
|