File size: 1,178 Bytes
6849423
2fd955b
9834f44
 
 
 
6849423
a43aea9
 
40c561c
 
a78a11d
e8453f9
9834f44
6849423
ca150b2
a78a11d
ca150b2
9834f44
 
afc63ec
9834f44
 
 
 
 
 
ca150b2
 
 
 
 
 
 
2cbc072
ca150b2
 
a78a11d
9834f44
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import gradio as gr
from langchain import PromptTemplate, LlamaCpp, LLMChain, FAISS
from langchain.callbacks import StreamingStdOutCallbackHandler
from langchain.callbacks.manager import CallbackManager
from langchain.chains.question_answering import load_qa_chain
import dill
def greet(name):
    db = dill.load(open("client_embebedings.mate", "rb"))
    return name+db
    #docs = db.similarity_search(name)
    #return chain.run(input_documents=docs, question=name)

def greet1(name):
    return "Hello ya client" +name

iface = gr.Blocks()

with iface:
    callback_manager = CallbackManager([StreamingStdOutCallbackHandler()])
    chain = load_qa_chain( LlamaCpp(
        model_path="llama-13B-Q4_K_M.gguf",
        temperature=0,
        top_p= 1,
        callback_manager=callback_manager,
        verbose=True,

    ), chain_type="stuff")
    name = gr.Textbox(label="Name")
    output = gr.Textbox(label="Output Box")

    greet_btn = gr.Button("Greet")
    greet_btn.click(fn=greet, inputs=name, outputs=output, api_name="greet")

    greet1_btn = gr.Button("Greet1")
    greet1_btn.click(fn=greet1, inputs=name, outputs=output, api_name="testing")

iface.launch()