Commit ·
b0cfb8c
1
Parent(s): 8eaf76a
feat: add logo on top
Browse files- gradio_app.py +23 -17
- requirements.txt +0 -0
gradio_app.py
CHANGED
|
@@ -38,7 +38,7 @@ async def run_agent(request, history):
|
|
| 38 |
image_path = ""
|
| 39 |
load_dotenv()
|
| 40 |
PANDAS_EXPORTS_PATH = os.getenv("PANDAS_EXPORTS_PATH")
|
| 41 |
-
generated_files = [f for f in os.listdir(PANDAS_EXPORTS_PATH) if f.
|
| 42 |
if generated_files:
|
| 43 |
image_path = os.path.join(PANDAS_EXPORTS_PATH, generated_files[0])
|
| 44 |
image_markdown = image_to_base64_markdown(image_path)
|
|
@@ -59,22 +59,28 @@ async def run_agent(request, history):
|
|
| 59 |
|
| 60 |
|
| 61 |
# ====================================== Gradio UI with history
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 78 |
|
| 79 |
|
| 80 |
# Gradio UI
|
|
|
|
| 38 |
image_path = ""
|
| 39 |
load_dotenv()
|
| 40 |
PANDAS_EXPORTS_PATH = os.getenv("PANDAS_EXPORTS_PATH")
|
| 41 |
+
generated_files = [f for f in os.listdir(PANDAS_EXPORTS_PATH) if f.startswith("temp_chart_") and f.endswith(".png")]
|
| 42 |
if generated_files:
|
| 43 |
image_path = os.path.join(PANDAS_EXPORTS_PATH, generated_files[0])
|
| 44 |
image_markdown = image_to_base64_markdown(image_path)
|
|
|
|
| 59 |
|
| 60 |
|
| 61 |
# ====================================== Gradio UI with history
|
| 62 |
+
LOGO_PATH = "resources/logo.png"
|
| 63 |
+
with gr.Blocks() as demo:
|
| 64 |
+
gr.Image(value=LOGO_PATH, height=100, width=100, elem_id="logo")
|
| 65 |
+
with gr.Row():
|
| 66 |
+
with gr.Column():
|
| 67 |
+
gr.Markdown("<center><h1>Talk to Your Data</h1></center>")
|
| 68 |
+
gr.ChatInterface(
|
| 69 |
+
fn=run_agent,
|
| 70 |
+
type="messages",
|
| 71 |
+
flagging_mode="manual",
|
| 72 |
+
flagging_options=["Like", "Spam", "Inappropriate", "Other"],
|
| 73 |
+
examples=[
|
| 74 |
+
"List all tables in the database",
|
| 75 |
+
"Show me the schema of the dim_customer table",
|
| 76 |
+
"Count the number of active customers in 2024",
|
| 77 |
+
"Create a pie chart showing the distribution of customer statuses in the dim_customer table.",
|
| 78 |
+
"Plot a line chart showing the trend of order quantities over order dates from the dim_product_order_item table.",
|
| 79 |
+
"Generate a bar chart displaying the count of products in each product class from the dim_product table. Use beautiful and vivid colors fro visualization.",
|
| 80 |
+
"Visualize the number of product orders over time from the dim_product_order_item table, using the order_date. Show the trend monthly.",
|
| 81 |
+
],
|
| 82 |
+
save_history=True,
|
| 83 |
+
)
|
| 84 |
|
| 85 |
|
| 86 |
# Gradio UI
|
requirements.txt
CHANGED
|
Binary files a/requirements.txt and b/requirements.txt differ
|
|
|