Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -6,6 +6,8 @@ from langchain_community.utilities import SQLDatabase
|
|
| 6 |
from langchain_community.agent_toolkits import SQLDatabaseToolkit
|
| 7 |
from langchain.agents import create_agent
|
| 8 |
import markdown as md
|
|
|
|
|
|
|
| 9 |
# from google.colab import userdata
|
| 10 |
|
| 11 |
# --- GLOBALS ---
|
|
@@ -26,11 +28,19 @@ PROVIDER_MODELS = {
|
|
| 26 |
"perplexity": ["sonar-small-chat", "sonar-medium-chat", "sonar-large-chat"]
|
| 27 |
}
|
| 28 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29 |
|
| 30 |
def create_chatbot_interface():
|
| 31 |
with gr.Blocks(theme=gr.themes.Ocean(font=[gr.themes.GoogleFont("Noto Sans")]),
|
| 32 |
css='footer {visibility: hidden}') as demo:
|
| 33 |
-
|
| 34 |
with gr.Accordion("π Description:", open=False):
|
| 35 |
gr.Markdown(md.description)
|
| 36 |
|
|
@@ -58,6 +68,9 @@ def create_chatbot_interface():
|
|
| 58 |
chatbot = gr.Chatbot()
|
| 59 |
msg = gr.Textbox(label="Enter your question")
|
| 60 |
clear = gr.Button("Clear")
|
|
|
|
|
|
|
|
|
|
| 61 |
|
| 62 |
# --- FUNCTIONS ---
|
| 63 |
|
|
|
|
| 6 |
from langchain_community.agent_toolkits import SQLDatabaseToolkit
|
| 7 |
from langchain.agents import create_agent
|
| 8 |
import markdown as md
|
| 9 |
+
import base64
|
| 10 |
+
|
| 11 |
# from google.colab import userdata
|
| 12 |
|
| 13 |
# --- GLOBALS ---
|
|
|
|
| 28 |
"perplexity": ["sonar-small-chat", "sonar-medium-chat", "sonar-large-chat"]
|
| 29 |
}
|
| 30 |
|
| 31 |
+
def encode_image(image_path):
|
| 32 |
+
with open(image_path, "rb") as image_file:
|
| 33 |
+
return base64.b64encode(image_file.read()).decode('utf-8')
|
| 34 |
+
|
| 35 |
+
# Encode the images
|
| 36 |
+
github_logo_encoded = encode_image("Images/github-logo.png")
|
| 37 |
+
linkedin_logo_encoded = encode_image("Images/linkedin-logo.png")
|
| 38 |
+
website_logo_encoded = encode_image("Images/ai-logo.png")
|
| 39 |
|
| 40 |
def create_chatbot_interface():
|
| 41 |
with gr.Blocks(theme=gr.themes.Ocean(font=[gr.themes.GoogleFont("Noto Sans")]),
|
| 42 |
css='footer {visibility: hidden}') as demo:
|
| 43 |
+
gr.Markdown("# DB Assistant ππ¨π»βπ")
|
| 44 |
with gr.Accordion("π Description:", open=False):
|
| 45 |
gr.Markdown(md.description)
|
| 46 |
|
|
|
|
| 68 |
chatbot = gr.Chatbot()
|
| 69 |
msg = gr.Textbox(label="Enter your question")
|
| 70 |
clear = gr.Button("Clear")
|
| 71 |
+
|
| 72 |
+
gr.HTML(md.footer.format(github_logo_encoded, linkedin_logo_encoded, website_logo_encoded))
|
| 73 |
+
|
| 74 |
|
| 75 |
# --- FUNCTIONS ---
|
| 76 |
|