FahadAlam commited on
Commit
ca1de39
1 Parent(s): ec46213

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +24 -4
app.py CHANGED
@@ -6,7 +6,7 @@ import matplotlib.pyplot as plt
6
  from sklearn.preprocessing import LabelEncoder
7
 
8
  def findCorrelation(dataset, target):
9
-
10
  df = pd.read_csv(dataset.name)
11
 
12
  non_numeric_cols = df.select_dtypes('object').columns.tolist()
@@ -44,7 +44,27 @@ def findCorrelation(dataset, target):
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", examples = examples)
50
- demo.launch(debug=True)
 
6
  from sklearn.preprocessing import LabelEncoder
7
 
8
  def findCorrelation(dataset, target):
9
+
10
  df = pd.read_csv(dataset.name)
11
 
12
  non_numeric_cols = df.select_dtypes('object').columns.tolist()
 
44
 
45
  return d, fig1, fig2, fig3, fig4
46
 
47
+ with gr.Blocks() as demo:
48
+ with gr.Row():
49
+ with gr.Column():
50
+ file = gr.File()
51
+ with gr.Column():
52
+ inp = gr.Textbox(placeholder="Enter the target feature name")
53
+ btn = gr.Button("Find Correlation")
54
+ with gr.Row():
55
+ labels = gr.Label(num_top_classes = 10)
56
+ with gr.Row():
57
+ fig1 = gr.Plot()
58
+ with gr.Row():
59
+ with gr.Column():
60
+ fig2 = gr.Plot()
61
+ with gr.Column():
62
+ fig3 = gr.Plot()
63
+ with gr.Row():
64
+ fig4 = gr.Plot()
65
+ with gr.Row():
66
+ gr.Examples(
67
+ examples = [["boston.csv", "MEDV"]], fn=findCorrelation, inputs=[file, inp], outputs=[labels, fig1, fig2, fig3, fig4])
68
+ btn.click( fn=findCorrelation, inputs=[file, inp], outputs=[labels, fig1, fig2, fig3, fig4])
69
 
70
+ demo.launch()