FahadAlam commited on
Commit
4057e5d
1 Parent(s): 182a28a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -7
app.py CHANGED
@@ -24,16 +24,27 @@ def findCorrelation(dataset, target):
24
  hm = sns.heatmap(df.corr(), annot = True)
25
  hm.set(title = "Correlation matrix of dataset\n")
26
 
27
- fig2 = plt.figure()
28
- sns.regplot(x=df[keys[0][0]], y=df[target])
 
 
 
29
 
30
- fig3 = plt.figure()
31
- sns.regplot(x=df[keys[1][0]], y=df[target])
 
 
 
32
 
33
- fig4 = plt.figure()
34
- sns.regplot(x=df[keys[2][0]], y=df[target])
35
-
 
 
 
36
  return d, fig1, fig2, fig3, fig4
37
 
 
 
38
  demo = gr.Interface(fn=findCorrelation, inputs=[gr.File(), 'text'], outputs=[gr.Label(num_top_classes = 10), gr.Plot(), gr.Plot(), gr.Plot(), gr.Plot()], title="Find correlation")
39
  demo.launch(debug=True)
 
24
  hm = sns.heatmap(df.corr(), annot = True)
25
  hm.set(title = "Correlation matrix of dataset\n")
26
 
27
+ try:
28
+ fig2 = plt.figure()
29
+ sns.regplot(x=df[keys[0][0]], y=df[target])
30
+ except:
31
+ fig2 = plt.figure()
32
 
33
+ try:
34
+ fig3 = plt.figure()
35
+ sns.regplot(x=df[keys[1][0]], y=df[target])
36
+ except:
37
+ fig3 = plt.figure()
38
 
39
+ try:
40
+ fig4 = plt.figure()
41
+ sns.regplot(x=df[keys[2][0]], y=df[target])
42
+ except:
43
+ fig4 = plt.figure()
44
+
45
  return d, fig1, fig2, fig3, fig4
46
 
47
+ examples = [["boston.csv", "MEDV"]]
48
+
49
  demo = gr.Interface(fn=findCorrelation, inputs=[gr.File(), 'text'], outputs=[gr.Label(num_top_classes = 10), gr.Plot(), gr.Plot(), gr.Plot(), gr.Plot()], title="Find correlation")
50
  demo.launch(debug=True)