Spaces:
Build error
Build error
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import supabase
|
2 |
+
import pandas as pd
|
3 |
+
import os
|
4 |
+
|
5 |
+
client = supabase.create_client(os.environ['SUPABASE_URL'], os.environ['SUPABASE_SECRET_KEY'])
|
6 |
+
|
7 |
+
def read_data():
|
8 |
+
response = client.table('Product').select("*").execute()
|
9 |
+
df = pd.DataFrame(response.data)
|
10 |
+
return df
|
11 |
+
|
12 |
+
import gradio as gr
|
13 |
+
|
14 |
+
with gr.Blocks() as dashboard:
|
15 |
+
with gr.Row():
|
16 |
+
gr.BarPlot(read_data, x="product_id", y="price", title="Prices", every=60)
|
17 |
+
gr.BarPlot(read_data, x="product_id", y="inventory_count", title="Inventory", every=60)
|
18 |
+
|
19 |
+
dashboard.queue().launch()
|