Spaces:
Sleeping
Sleeping
import os | |
from langchain.document_loaders import ( | |
CSVLoader, | |
EverNoteLoader, | |
PDFMinerLoader, | |
TextLoader, | |
UnstructuredEPubLoader, | |
UnstructuredHTMLLoader, | |
UnstructuredMarkdownLoader, | |
UnstructuredODTLoader, | |
UnstructuredPowerPointLoader, | |
UnstructuredWordDocumentLoader, | |
) | |
FAVICON_PATH: str = 'https://modishcard.com/app/assets/icons/ModishCard_Logo6-02.svg' | |
SYSTEM_PROMPT: str = "You are Saiga, a Englis-speaking automated assistant. You talk to people and help them." | |
SYSTEM_TOKEN: int = 1788 | |
USER_TOKEN: int = 1404 | |
BOT_TOKEN: int = 9225 | |
LINEBREAK_TOKEN: int = 13 | |
ROLE_TOKENS: dict = { | |
"user": USER_TOKEN, | |
"bot": BOT_TOKEN, | |
"system": SYSTEM_TOKEN | |
} | |
LOADER_MAPPING: dict = { | |
".csv": (CSVLoader, {}), | |
".doc": (UnstructuredWordDocumentLoader, {}), | |
".docx": (UnstructuredWordDocumentLoader, {}), | |
".enex": (EverNoteLoader, {}), | |
".epub": (UnstructuredEPubLoader, {}), | |
".html": (UnstructuredHTMLLoader, {}), | |
".md": (UnstructuredMarkdownLoader, {}), | |
".odt": (UnstructuredODTLoader, {}), | |
".pdf": (PDFMinerLoader, {}), | |
".ppt": (UnstructuredPowerPointLoader, {}), | |
".pptx": (UnstructuredPowerPointLoader, {}), | |
".txt": (TextLoader, {"encoding": "utf8"}), | |
} | |
DICT_REPO_AND_MODELS: dict = { | |
"https://huggingface.co/Qwen/Qwen2-0.5B-Instruct-GGUF/resolve/main/qwen2-0_5b-instruct-q8_0.gguf": | |
"Qwen/Qwen2-0.5B-Instruct-GGUF", | |
"https://huggingface.co/MaziyarPanahi/Qwen2-1.5B-Instruct-GGUF/resolve/main/Qwen2-1.5B-Instruct.Q8_0.gguf": | |
"MaziyarPanahi/Qwen2-1.5B-Instruct.Q8_0.gguf", | |
} | |
EMBEDDER_NAME: str = "sentence-transformers/paraphrase-multilingual-mpnet-base-v2" | |
MAX_NEW_TOKENS: int = 1500 | |
ABS_PATH = os.path.dirname(os.path.abspath(__file__)) | |
MODELS_DIR = os.path.join(ABS_PATH, "../models") | |
AUTH_FILE = os.path.join(ABS_PATH, "auth.csv") | |
BLOCK_CSS = """ | |
#buttons button { | |
min-width: min(120px,100%); | |
} | |
""" | |