Spaces:
Runtime error
Runtime error
Create new file
Browse files
app.py
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
import pandas as pd
|
3 |
+
from sklearn import datasets
|
4 |
+
import seaborn as sns
|
5 |
+
import matplotlib.pyplot as plt
|
6 |
+
|
7 |
+
def findCorrelation():
|
8 |
+
iris = datasets.load_iris()
|
9 |
+
df = pd.DataFrame(data=iris.data, columns=iris.feature_names)
|
10 |
+
|
11 |
+
df["target"] = iris.target
|
12 |
+
|
13 |
+
correlation = df["sepal length (cm)"].corr(df["petal length (cm)"])
|
14 |
+
corr = df.corr()
|
15 |
+
|
16 |
+
hm = sns.heatmap(df.corr(), annot = True)
|
17 |
+
hm.set(xlabel='\nIRIS Flower Details', ylabel='IRIS Flower Details\t', title = "Correlation matrix of IRIS data\n")
|
18 |
+
|
19 |
+
# use the function regplot to make a scatterplot
|
20 |
+
sns.regplot(x=df["sepal length (cm)"], y=df["sepal width (cm)"])
|
21 |
+
plt.show()
|
22 |
+
return plt, plt
|
23 |
+
|
24 |
+
demo = gr.Interface(fn=findCorrelation, inputs=[], outputs=[gr.Plot(), gr.Plot()], title="Find correlation")
|
25 |
+
demo.launch()
|