FahadAlam's picture
Update app.py
5ceed16
raw
history blame
869 Bytes
import gradio as gr
import pandas as pd
from sklearn import datasets
import seaborn as sns
import matplotlib.pyplot as plt
def findCorrelation():
iris = datasets.load_iris()
df = pd.DataFrame(data=iris.data, columns=iris.feature_names)
df["target"] = iris.target
correlation = df["sepal length (cm)"].corr(df["petal length (cm)"])
corr = df.corr()
fig1 = plt.figure()
hm = sns.heatmap(df.corr(), annot = True)
hm.set(xlabel='\nIRIS Flower Details', ylabel='IRIS Flower Details\t', title = "Correlation matrix of IRIS data\n")
fig2 = plt.figure()
# use the function regplot to make a scatterplot
sns.regplot(x=df["sepal length (cm)"], y=df["sepal width (cm)"])
plt.show()
return fig1, fig2, plt
demo = gr.Interface(fn=findCorrelation, inputs=[], outputs=[gr.Plot(), gr.Plot(), gr.Plot()], title="Find correlation")
demo.launch()