supabase / app.py
aliabd's picture
aliabd HF Staff
Create app.py
1793c48 verified
raw
history blame contribute delete
570 Bytes
import supabase
import pandas as pd
import os
client = supabase.create_client(os.environ['SUPABASE_URL'], os.environ['SUPABASE_SECRET_KEY'])
def read_data():
response = client.table('Product').select("*").execute()
df = pd.DataFrame(response.data)
return df
import gradio as gr
with gr.Blocks() as dashboard:
with gr.Row():
gr.BarPlot(read_data, x="product_id", y="price", title="Prices", every=gr.Timer(60))
gr.BarPlot(read_data, x="product_id", y="inventory_count", title="Inventory", every=gr.Timer(60))
dashboard.queue().launch()