Spaces:
Running
Running
Commit
·
e7aa5a2
1
Parent(s):
98fb43c
preload
Browse files
ai_med_extract/api/__pycache__/routes.cpython-311.pyc
CHANGED
Binary files a/ai_med_extract/api/__pycache__/routes.cpython-311.pyc and b/ai_med_extract/api/__pycache__/routes.cpython-311.pyc differ
|
|
ai_med_extract/api/routes.py
CHANGED
@@ -319,6 +319,18 @@ def register_routes(app, agents):
|
|
319 |
from ai_med_extract.utils.openvino_summarizer_utils import (
|
320 |
parse_ehr_chartsummarydtl, visits_sorted, compute_deltas, build_compact_baseline, delta_to_text, build_main_prompt
|
321 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
322 |
|
323 |
@app.route('/api/patient_summary_openvino', methods=['POST'])
|
324 |
def patient_summary_openvino():
|
|
|
319 |
from ai_med_extract.utils.openvino_summarizer_utils import (
|
320 |
parse_ehr_chartsummarydtl, visits_sorted, compute_deltas, build_compact_baseline, delta_to_text, build_main_prompt
|
321 |
)
|
322 |
+
# ============ HF SPACES: PRE-LOAD GGUF MODEL AT STARTUP ============
|
323 |
+
print("[HF SPACES] ⏳ Pre-loading GGUF model to prevent startup timeout...")
|
324 |
+
try:
|
325 |
+
from ai_med_extract.utils.model_loader_gguf import GGUFModelPipeline
|
326 |
+
model_name = "microsoft/Phi-3-mini-4k-instruct-gguf"
|
327 |
+
filename = "Phi-3-mini-4k-instruct-q4.gguf"
|
328 |
+
# This will download and load the model NOW, during app startup
|
329 |
+
pipeline = GGUFModelPipeline(model_name, filename)
|
330 |
+
print("[HF SPACES] ✅ GGUF model pre-loaded successfully!")
|
331 |
+
except Exception as e:
|
332 |
+
print(f"[HF SPACES] ❌ Pre-load failed (fallback will handle it): {e}")
|
333 |
+
# ============ END PRE-LOAD ============
|
334 |
|
335 |
@app.route('/api/patient_summary_openvino', methods=['POST'])
|
336 |
def patient_summary_openvino():
|
requirements.txt
CHANGED
@@ -164,6 +164,7 @@ wrapt==1.17.3
|
|
164 |
xxhash==3.5.0
|
165 |
yarl==1.20.1
|
166 |
llama-cpp-python==0.2.72
|
|
|
167 |
|
168 |
# Add timeout and signal handling dependencies
|
169 |
timeout-decorator==0.5.0
|
|
|
164 |
xxhash==3.5.0
|
165 |
yarl==1.20.1
|
166 |
llama-cpp-python==0.2.72
|
167 |
+
ctransformers>=0.2.0
|
168 |
|
169 |
# Add timeout and signal handling dependencies
|
170 |
timeout-decorator==0.5.0
|