merve HF staff commited on
Commit
bfef21c
1 Parent(s): 4c207a0

Create new file

Browse files
Files changed (1) hide show
  1. app.py +36 -0
app.py ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import pandas as pd
3
+ import datasets
4
+ import seaborn as sns
5
+ import matplotlib.pyplot as plt
6
+
7
+ df = datasets.load_dataset("merve/supersoaker-failures")
8
+ df = df["train"].to_pandas()
9
+ df.dropna(axis=0, inplace=True)
10
+ df.drop(columns=["id"], inplace=True)
11
+
12
+ def plot(df):
13
+ plots = []
14
+ plt.scatter(df.measurement_13, df.measurement_15, c = df.loading,alpha=0.5)
15
+ plt.savefig("scatter.png")
16
+ plt.scatter(df.measurement_10, df.measurement_15, c = df.loading,alpha=0.5)
17
+ plt.savefig("scatter_2.png")
18
+ plt.scatter(df.measurement_14, df.measurement_15, c = df.loading,alpha=0.5)
19
+ plt.savefig("scatter_3.png")
20
+ df['failure'].value_counts().plot(kind='bar')
21
+ plt.savefig("bar.png")
22
+ sns.distplot(df["loading"])
23
+ plt.savefig("loading_dist.png")
24
+ sns.distplot(df["attribute_3"])
25
+ plt.savefig("attribute_3.png")
26
+ sns.catplot(x='measurement_3', y='measurement_4', hue='failure', data=df, kind='violin')
27
+ plt.savefig("swarmplot.png")
28
+ sns.heatmap(df.select_dtypes(include="number").corr())
29
+ plt.savefig("corr.png")
30
+ plots = ["corr.png","scatter.png", "bar.png", "loading_dist.png", "attribute_3.png", "swarmplot.png"]
31
+ return plots
32
+
33
+ inputs = [gr.Dataframe()]
34
+ outputs = [gr.Gallery().style(grid=(3,3))]
35
+
36
+ gr.Interface(plot, inputs=inputs, outputs=outputs, examples=[df.head(100)]).launch()