Spaces:
Sleeping
Sleeping
feat: add tokenizer model and summarization model
Browse files
app.py
CHANGED
@@ -16,15 +16,16 @@ logging.basicConfig(level=logging.INFO)
|
|
16 |
DATA_DIR = "/data" if os.path.exists("/data") else "."
|
17 |
DATASET_DIR = os.path.join(DATA_DIR, "rag_dataset")
|
18 |
DATASET_PATH = os.path.join(DATASET_DIR, "dataset")
|
19 |
-
|
|
|
20 |
|
21 |
@st.cache_resource
|
22 |
def load_local_model():
|
23 |
"""Load the local Hugging Face model"""
|
24 |
try:
|
25 |
-
tokenizer = AutoTokenizer.from_pretrained(
|
26 |
model = T5ForConditionalGeneration.from_pretrained(
|
27 |
-
|
28 |
device_map={"": "cpu"}, # Force CPU
|
29 |
torch_dtype=torch.float32
|
30 |
)
|
|
|
16 |
DATA_DIR = "/data" if os.path.exists("/data") else "."
|
17 |
DATASET_DIR = os.path.join(DATA_DIR, "rag_dataset")
|
18 |
DATASET_PATH = os.path.join(DATASET_DIR, "dataset")
|
19 |
+
TOKENIZER_MODEL = "google/flan-t5-small"
|
20 |
+
SUMMARIZATION_MODEL= "Falconsai/text_summarization"
|
21 |
|
22 |
@st.cache_resource
|
23 |
def load_local_model():
|
24 |
"""Load the local Hugging Face model"""
|
25 |
try:
|
26 |
+
tokenizer = AutoTokenizer.from_pretrained(TOKENIZER_MODEL)
|
27 |
model = T5ForConditionalGeneration.from_pretrained(
|
28 |
+
SUMMARIZATION_MODEL,
|
29 |
device_map={"": "cpu"}, # Force CPU
|
30 |
torch_dtype=torch.float32
|
31 |
)
|