Juridiquebot / app.py
Docfile's picture
Update app.py
e430e67 verified
raw
history blame
1.22 kB
import os
from embedchain import Pipeline as App
import gradio as gr
os.environ["GOOGLE_API_KEY"] = "AIzaSyDYhyRoOWBJWOb4bqY5wmFLrBo4HTwQDko"
app = App.from_config(config={
"llm": {
"provider": "google",
"config": {
"model": "gemini-pro",
"temperature": 0.5,
"max_tokens": 1000,
"top_p": 1,
"stream": False,
"template": """
Use the following pieces of context to answer the query at the end.
If you don't know the answer, just say that you don't know, don't try to make up an answer.
$history
$context
Query: $query
Helpful Answer:
""",
},
},
"embedder": {
"provider": "google",
"config": {
"model": "models/embedding-001",
},
},
})
#app.add('http://www.droit-afrique.com/uploads/Gabon-Code-2019-penal.pdf', data_type='pdf_file')
link = "https://youtu.be/PbX2t2bEgxg?si=-iK6g9uAhYEE-zU3"
app.add(link,data_type="youtube_video")
def query(message, history):
return app.chat(message)
demo = gr.ChatInterface(query)
demo.launch()