File size: 868 Bytes
fac37fe
 
 
 
 
 
 
 
 
 
 
6448874
fac37fe
 
6448874
 
fac37fe
 
6448874
 
fac37fe
 
 
6448874
 
fac37fe
6448874
fac37fe
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
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()