sxd3125 commited on
Commit
79c9b04
1 Parent(s): da63e27

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -1
app.py CHANGED
@@ -5,6 +5,9 @@ from pandasai.llm.starcoder import Starcoder
5
  import matplotlib.pyplot as plt
6
  #import gradio as gr
7
 
 
 
 
8
  # Define List of Models
9
 
10
  models = {"Starcoder": Starcoder}
@@ -27,4 +30,12 @@ prompt = 'Plot the histogram of countries showing for each the gdp, using differ
27
  response = pandas_ai.run(df, prompt=prompt,
28
  is_conversational_answer=False)
29
 
30
- response.figure.savefig('chart.jpg')
 
 
 
 
 
 
 
 
 
5
  import matplotlib.pyplot as plt
6
  #import gradio as gr
7
 
8
+ def make_plot(x):
9
+ return x.figure
10
+
11
  # Define List of Models
12
 
13
  models = {"Starcoder": Starcoder}
 
30
  response = pandas_ai.run(df, prompt=prompt,
31
  is_conversational_answer=False)
32
 
33
+ with gr.Blocks(title=title) as demo:
34
+ gr.Markdown('''
35
+ <div>
36
+ <h1 style='text-align: center'>Plot</h1>
37
+ </div>
38
+ ''')
39
+ o1=gr.Plot()
40
+ btn = gr.Button(value = 'Submit')
41
+ btn.click(make_plot,inputs=[response],outputs=[o1])