import pandas as pd import gradio as gr from datasets import load_dataset LOGS_DATASET_URI = 'pgurazada1/machine-failure-mlops-demo-logs' def get_data(): """ Connect to the HuggingFace dataset where the logs are stored. Pull the data into a dataframe """ data = load_dataset(LOGS_DATASET_URI) tail_df = data['train'].to_pandas().tail(5) return tail_df # Every 5 seconds, pull in the latest data from the HF dataset with gr.Blocks() as demo: gr.Markdown("Real-time Monitoring Dashboard") with gr.Row(): with gr.Column(): gr.DataFrame(get_data) demo.queue().launch()