Spaces:
Sleeping
Sleeping
zeyadahmedd
commited on
Commit
·
9834f44
1
Parent(s):
1e656fe
Update app.py
Browse files
app.py
CHANGED
@@ -1,15 +1,29 @@
|
|
1 |
import gradio as gr
|
2 |
-
|
|
|
|
|
|
|
|
|
3 |
def greet(name):
|
4 |
-
|
|
|
|
|
5 |
|
6 |
def greet1(name):
|
7 |
-
return "Hello ya client" +name
|
8 |
|
9 |
iface = gr.Blocks()
|
10 |
|
11 |
with iface:
|
12 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
name = gr.Textbox(label="Name")
|
14 |
output = gr.Textbox(label="Output Box")
|
15 |
|
@@ -21,3 +35,5 @@ with iface:
|
|
21 |
|
22 |
iface.launch()
|
23 |
|
|
|
|
|
|
1 |
import gradio as gr
|
2 |
+
from langchain import LlamaCpp
|
3 |
+
from langchain.callbacks import StreamingStdOutCallbackHandler
|
4 |
+
from langchain.callbacks.manager import CallbackManager
|
5 |
+
from langchain.chains.question_answering import load_qa_chain
|
6 |
+
import dill
|
7 |
def greet(name):
|
8 |
+
db = dill.load(open("client_embebedings.mate", "rb"))
|
9 |
+
docs = db.similarity_search(name)
|
10 |
+
return chain.run(input_documents=docs, question=name)
|
11 |
|
12 |
def greet1(name):
|
13 |
+
return "Hello ya client" +name
|
14 |
|
15 |
iface = gr.Blocks()
|
16 |
|
17 |
with iface:
|
18 |
+
callback_manager = CallbackManager([StreamingStdOutCallbackHandler()])
|
19 |
+
chain = load_qa_chain( LlamaCpp(
|
20 |
+
model_path="model\llama-13B-Q4_K_M.gguf",
|
21 |
+
temperature=0,
|
22 |
+
top_p= 1,
|
23 |
+
callback_manager=callback_manager,
|
24 |
+
verbose=True,
|
25 |
+
|
26 |
+
), chain_type="stuff")
|
27 |
name = gr.Textbox(label="Name")
|
28 |
output = gr.Textbox(label="Output Box")
|
29 |
|
|
|
35 |
|
36 |
iface.launch()
|
37 |
|
38 |
+
|
39 |
+
|