Spaces:
Runtime error
Runtime error
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import pandas as pd
|
2 |
+
import gradio as gr
|
3 |
+
|
4 |
+
from datasets import load_dataset
|
5 |
+
|
6 |
+
LOGS_DATASET_URI = 'pgurazada1/machine-failure-mlops-demo-logs'
|
7 |
+
|
8 |
+
|
9 |
+
def get_data():
|
10 |
+
"""
|
11 |
+
Connect to the HuggingFace dataset where the logs are stored.
|
12 |
+
Pull the data into a dataframe
|
13 |
+
"""
|
14 |
+
data = load_dataset(LOGS_DATASET_URI)
|
15 |
+
data_df = data['train'].to_pandas()
|
16 |
+
|
17 |
+
return data_df
|
18 |
+
|
19 |
+
# Every 5 seconds, pull in the latest data from the dataset and make a
|
20 |
+
# Bar plot of the predictions
|
21 |
+
|
22 |
+
with gr.Blocks() as demo:
|
23 |
+
gr.Demo("Real-time Monitoring Dashboard")
|
24 |
+
with gr.Row():
|
25 |
+
with gr.Column():
|
26 |
+
gr.BarPlot(get_data, every=5, x='prediction', width=500, height=500)
|
27 |
+
|
28 |
+
demo.queue().launch()
|