Commit
·
ad309ea
1
Parent(s):
400dc53
feat: init project
Browse files
app.py
CHANGED
@@ -10,6 +10,7 @@ from llama_index.llms.llama_cpp.llama_utils import (
|
|
10 |
completion_to_prompt,
|
11 |
)
|
12 |
from llama_index.core.memory import ChatMemoryBuffer
|
|
|
13 |
|
14 |
|
15 |
def import_documents():
|
@@ -62,6 +63,9 @@ def create_llm():
|
|
62 |
)
|
63 |
|
64 |
|
|
|
|
|
|
|
65 |
documents = import_documents()
|
66 |
embed_model = create_embed_model()
|
67 |
index = create_store_index(documents=documents, embed_model=embed_model)
|
@@ -92,14 +96,15 @@ def querying(query, history):
|
|
92 |
|
93 |
|
94 |
iface = gr.ChatInterface(
|
95 |
-
fn
|
96 |
chatbot=gr.Chatbot(
|
97 |
height=600,
|
98 |
),
|
99 |
textbox=gr.Textbox(placeholder="Bonjour :)", container=False, scale=7),
|
100 |
title="ZatsBot",
|
101 |
theme="soft",
|
102 |
-
examples=["Qui est Zatsit ?", "Quelles sont vos coordonnées ?", "Quels sont vos domaines d'expertise ?",
|
|
|
103 |
cache_examples=False,
|
104 |
retry_btn="Répéter",
|
105 |
undo_btn="Annuler",
|
|
|
10 |
completion_to_prompt,
|
11 |
)
|
12 |
from llama_index.core.memory import ChatMemoryBuffer
|
13 |
+
import nltk
|
14 |
|
15 |
|
16 |
def import_documents():
|
|
|
63 |
)
|
64 |
|
65 |
|
66 |
+
nltk.download('punkt')
|
67 |
+
nltk.download('punkt_tab')
|
68 |
+
|
69 |
documents = import_documents()
|
70 |
embed_model = create_embed_model()
|
71 |
index = create_store_index(documents=documents, embed_model=embed_model)
|
|
|
96 |
|
97 |
|
98 |
iface = gr.ChatInterface(
|
99 |
+
fn=querying,
|
100 |
chatbot=gr.Chatbot(
|
101 |
height=600,
|
102 |
),
|
103 |
textbox=gr.Textbox(placeholder="Bonjour :)", container=False, scale=7),
|
104 |
title="ZatsBot",
|
105 |
theme="soft",
|
106 |
+
examples=["Qui est Zatsit ?", "Quelles sont vos coordonnées ?", "Quels sont vos domaines d'expertise ?",
|
107 |
+
"Quels sont vos clients ?"],
|
108 |
cache_examples=False,
|
109 |
retry_btn="Répéter",
|
110 |
undo_btn="Annuler",
|