Spaces:
Running
Running
Remove arbitrary document truncation and increase API request timeouts to 300 seconds
Browse files- pipeline.py +1 -4
pipeline.py
CHANGED
|
@@ -65,7 +65,7 @@ def call_hf_router(model: str, messages: list, token: str) -> str:
|
|
| 65 |
"https://router.huggingface.co/v1/chat/completions",
|
| 66 |
headers=headers,
|
| 67 |
json=data,
|
| 68 |
-
timeout=
|
| 69 |
)
|
| 70 |
response.raise_for_status()
|
| 71 |
res_json = response.json()
|
|
@@ -150,9 +150,6 @@ def stage_1a_segment_transcript(transcript_text: str, token: str) -> list:
|
|
| 150 |
|
| 151 |
# --- STAGE 1b: Extract themes ---
|
| 152 |
def stage_1b_extract_themes(doc_text: str, token: str) -> str:
|
| 153 |
-
if len(doc_text) > 40000:
|
| 154 |
-
doc_text = doc_text[:40000] + "\n...[Document Truncated]..."
|
| 155 |
-
|
| 156 |
system_prompt = (
|
| 157 |
"You are an expert researcher. Extract the main themes, key concepts, core arguments, facts, terminology, "
|
| 158 |
"and themes from the following document.\n"
|
|
|
|
| 65 |
"https://router.huggingface.co/v1/chat/completions",
|
| 66 |
headers=headers,
|
| 67 |
json=data,
|
| 68 |
+
timeout=300
|
| 69 |
)
|
| 70 |
response.raise_for_status()
|
| 71 |
res_json = response.json()
|
|
|
|
| 150 |
|
| 151 |
# --- STAGE 1b: Extract themes ---
|
| 152 |
def stage_1b_extract_themes(doc_text: str, token: str) -> str:
|
|
|
|
|
|
|
|
|
|
| 153 |
system_prompt = (
|
| 154 |
"You are an expert researcher. Extract the main themes, key concepts, core arguments, facts, terminology, "
|
| 155 |
"and themes from the following document.\n"
|