Spaces:
Running
Running
Update src/streamlit_app.py
Browse files- src/streamlit_app.py +10 -2
src/streamlit_app.py
CHANGED
|
@@ -23,10 +23,18 @@ def load_pipeline():
|
|
| 23 |
if 'model.safetensors' in files:
|
| 24 |
actual_path = root
|
| 25 |
break
|
| 26 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 27 |
|
|
|
|
| 28 |
distil_tokenizer = DistilBertTokenizerFast.from_pretrained(actual_path)
|
| 29 |
-
distil_model = DistilBertForSequenceClassification.from_pretrained(actual_path)
|
|
|
|
| 30 |
|
| 31 |
|
| 32 |
# 2. Knowledge Base & Retriever
|
|
|
|
| 23 |
if 'model.safetensors' in files:
|
| 24 |
actual_path = root
|
| 25 |
break
|
| 26 |
+
import os
|
| 27 |
+
|
| 28 |
+
# 1. Get the directory of the current script (the /src folder)
|
| 29 |
+
current_dir = os.path.dirname(os.path.abspath(__file__))
|
| 30 |
+
|
| 31 |
+
# 2. Go up one level to the root, then into the model folder
|
| 32 |
+
actual_path = os.path.join(current_dir, "..", "autoresolve_distilbert_final")
|
| 33 |
|
| 34 |
+
# 3. Load the model using this strict absolute path
|
| 35 |
distil_tokenizer = DistilBertTokenizerFast.from_pretrained(actual_path)
|
| 36 |
+
distil_model = DistilBertForSequenceClassification.from_pretrained(actual_path)
|
| 37 |
+
|
| 38 |
|
| 39 |
|
| 40 |
# 2. Knowledge Base & Retriever
|