Update app.py
Browse files
app.py
CHANGED
@@ -8,56 +8,49 @@ from langchain_g4f import G4FLLM
|
|
8 |
g4f.debug.logging = True # Enable logging
|
9 |
g4f.check_version = False # Disable automatic version checking
|
10 |
#print(g4f.version) # Check version
|
11 |
-
print(g4f.Provider.Ails.params) # Supported args
|
12 |
|
13 |
|
14 |
-
url = "https://app.embedchain.ai/api/v1/pipelines/f14b3df8-db63-456c-8a7f-4323b4467271/context/"
|
15 |
|
|
|
16 |
|
17 |
|
18 |
def greet(name):
|
19 |
-
|
20 |
"query": f"{name}",
|
21 |
-
"count":
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
msg.submit(respond, [msg, chatbot], [msg, chatbot])
|
58 |
-
|
59 |
-
demo.launch()
|
60 |
-
|
61 |
-
|
62 |
-
#iface = gr.Interface(fn=greet, inputs="text", outputs="text")
|
63 |
-
#iface.launch()
|
|
|
8 |
g4f.debug.logging = True # Enable logging
|
9 |
g4f.check_version = False # Disable automatic version checking
|
10 |
#print(g4f.version) # Check version
|
11 |
+
#print(g4f.Provider.Ails.params) # Supported args
|
12 |
|
13 |
|
|
|
14 |
|
15 |
+
url = "https://app.embedchain.ai/api/v1/pipelines/024a60fa-cfc3-41a2-a27b-2f6a04c1a6fe/context/"
|
16 |
|
17 |
|
18 |
def greet(name):
|
19 |
+
payload = {
|
20 |
"query": f"{name}",
|
21 |
+
"count": 25 }
|
22 |
+
headers = {
|
23 |
+
'Authorization': 'Token ec-fBwP02l3yodIa40BHkSEdhqVQmelK8pNsbrUew2J',}
|
24 |
+
response = requests.request("POST", url, headers=headers, json=payload)
|
25 |
+
|
26 |
+
print(response.text)
|
27 |
+
print(name)
|
28 |
+
c = response.text
|
29 |
+
llm = LLM = G4FLLM(model=models.gpt_35_turbo_16k )
|
30 |
+
res = llm(f"""
|
31 |
+
Use the following pieces of context to answer the query at the end.
|
32 |
+
If you don't know the answer, just say that you don't know, don't try to make up an answer.
|
33 |
+
|
34 |
+
${c}
|
35 |
+
|
36 |
+
Query: ${name}
|
37 |
+
|
38 |
+
Helpful Answer:
|
39 |
+
system_prompt: |
|
40 |
+
Agis en tant qu'assistant juridique gabonais Répons au question en français et en citant les articles .
|
41 |
+
|
42 |
+
""")
|
43 |
+
print(res)
|
44 |
+
return res
|
45 |
+
|
46 |
+
|
47 |
+
|
48 |
+
iface = gr.Interface(
|
49 |
+
fn=greet,
|
50 |
+
inputs="text",
|
51 |
+
outputs=gr.Textbox(label="Réponse"),
|
52 |
+
title="bot",
|
53 |
+
description=" Chatbot-law-code-pénal ")
|
54 |
+
|
55 |
+
iface.launch()
|
56 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|