Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -4,9 +4,21 @@ from pypdf import PdfReader
|
|
4 |
import os
|
5 |
from transformers import pipeline
|
6 |
|
7 |
-
|
8 |
-
|
9 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
|
11 |
def extract_text(file):
|
12 |
|
|
|
4 |
import os
|
5 |
from transformers import pipeline
|
6 |
|
7 |
+
|
8 |
+
model_path = "models"
|
9 |
+
model_name = "mistral-7b-instruct-v0.1.Q4_K_M.gguf"
|
10 |
+
|
11 |
+
hf_hub_download(repo_id="TheBloke/Mistral-7B-Instruct-v0.1-GGUF", filename=model_name, local_dir=model_path, local_dir_use_symlinks=False)
|
12 |
+
|
13 |
+
print("Start the model init process")
|
14 |
+
model = model = GPT4All(model_name, model_path, allow_download = False, device="cpu")
|
15 |
+
|
16 |
+
|
17 |
+
model.config["promptTemplate"] = "[INST] {0} [/INST]"
|
18 |
+
model.config["systemPrompt"] = "Tu es un assitant et tu dois répondre en français"
|
19 |
+
model._is_chat_session_activated = False
|
20 |
+
|
21 |
+
max_new_tokens = 2048
|
22 |
|
23 |
def extract_text(file):
|
24 |
|