FahadAlam's picture
Create new file
fac37fe
raw
history blame
797 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()
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")
# use the function regplot to make a scatterplot
sns.regplot(x=df["sepal length (cm)"], y=df["sepal width (cm)"])
plt.show()
return plt, plt
demo = gr.Interface(fn=findCorrelation, inputs=[], outputs=[gr.Plot(), gr.Plot()], title="Find correlation")
demo.launch()