Spaces:
Runtime error
Runtime error
File size: 1,681 Bytes
bfef21c 24373d3 bfef21c 24373d3 bfef21c 24373d3 bfef21c 24373d3 23c17f5 bfef21c 24373d3 bfef21c ac6bae5 bfef21c ac6bae5 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
import gradio as gr
import pandas as pd
import datasets
import seaborn as sns
import matplotlib.pyplot as plt
df = datasets.load_dataset("merve/supersoaker-failures")
df = df["train"].to_pandas()
df.dropna(axis=0, inplace=True)
df.drop(columns=["id"], inplace=True)
def plot(df):
plots = []
plt.scatter(df.measurement_13, df.measurement_15, c = df.failure, alpha=0.5)
plt.savefig("scatter.png")
plt.scatter(df.measurement_10, df.measurement_15, c = df.failure, alpha=0.5)
plt.savefig("scatter_2.png")
plt.scatter(df.measurement_14, df.measurement_15, c = df.failure, alpha=0.5)
plt.savefig("scatter_3.png")
plt.scatter(df.measurement_16, df.measurement_15, c = df.failure, alpha=0.5)
plt.savefig("scatter_4.png")
df['failure'].value_counts().plot(kind='bar')
plt.savefig("bar.png")
sns.distplot(df["loading"])
plt.savefig("loading_dist.png")
sns.distplot(df["attribute_3"])
plt.savefig("attribute_3.png")
sns.catplot(x='measurement_3', y='measurement_4', hue='failure', data=df, kind='violin')
plt.savefig("swarmplot.png")
sns.heatmap(df.select_dtypes(include="number").corr())
plt.savefig("corr.png")
plots = ["corr.png","scatter.png", "scatter_2.png", "scatter_3.png", "scatter_4.png", "bar.png", "loading_dist.png", "attribute_3.png", "swarmplot.png"]
return plots
inputs = [gr.Dataframe(label="Supersoaker Production Data")]
outputs = [gr.Gallery(label="Profiling Dashboard").style(grid=(3,3))]
gr.Interface(plot, inputs=inputs, outputs=outputs, examples=[df.head(100)], title="Supersoaker Failures Analysis Dashboard", description="This is a data analysis & visualization dashboard based on supersoaker failures data.").launch() |