Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -11,13 +11,18 @@ app = Flask(__name__, template_folder=os.getcwd())
|
|
11 |
|
12 |
# Default settings
|
13 |
class ChatConfig:
|
14 |
-
MODEL = "
|
15 |
DEFAULT_SYSTEM_MSG = "You are an AI assistant answering only based on the uploaded PDF."
|
16 |
DEFAULT_MAX_TOKENS = 512
|
17 |
DEFAULT_TEMP = 0.3
|
18 |
DEFAULT_TOP_P = 0.95
|
19 |
|
20 |
-
|
|
|
|
|
|
|
|
|
|
|
21 |
embed_model = SentenceTransformer("all-MiniLM-L6-v2", cache_folder="/tmp")
|
22 |
vector_dim = 384 # Embedding size
|
23 |
index = faiss.IndexFlatL2(vector_dim) # FAISS index
|
|
|
11 |
|
12 |
# Default settings
|
13 |
class ChatConfig:
|
14 |
+
MODEL = "mistralai/Mistral-7B-Instruct-v0.2"
|
15 |
DEFAULT_SYSTEM_MSG = "You are an AI assistant answering only based on the uploaded PDF."
|
16 |
DEFAULT_MAX_TOKENS = 512
|
17 |
DEFAULT_TEMP = 0.3
|
18 |
DEFAULT_TOP_P = 0.95
|
19 |
|
20 |
+
# Get the token from environment variable
|
21 |
+
HF_TOKEN = os.getenv('HUGGINGFACE_TOKEN')
|
22 |
+
client = InferenceClient(
|
23 |
+
ChatConfig.MODEL,
|
24 |
+
token=HF_TOKEN # Add your Hugging Face token here
|
25 |
+
)
|
26 |
embed_model = SentenceTransformer("all-MiniLM-L6-v2", cache_folder="/tmp")
|
27 |
vector_dim = 384 # Embedding size
|
28 |
index = faiss.IndexFlatL2(vector_dim) # FAISS index
|