ZachGF commited on
Commit
a30008c
·
verified ·
1 Parent(s): bc683d5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -3
app.py CHANGED
@@ -13,14 +13,16 @@ def plot_graph(file):
13
  plt.ylabel('Y-axis')
14
  plt.grid(True)
15
  # Save the plot to a file
16
- plt.savefig('plot.png')
17
- return 'plot.png'
 
 
18
 
19
  # Define the Gradio interface
20
  interface = gr.Interface(
21
  fn=plot_graph,
22
  inputs=gr.File(label="Upload CSV File"),
23
- outputs=gr.Image(type="file", label="Generated Graph"),
24
  title="Tabular Data Plotter"
25
  )
26
 
 
13
  plt.ylabel('Y-axis')
14
  plt.grid(True)
15
  # Save the plot to a file
16
+ plot_filename = 'plot.png'
17
+ plt.savefig(plot_filename)
18
+ plt.close()
19
+ return plot_filename
20
 
21
  # Define the Gradio interface
22
  interface = gr.Interface(
23
  fn=plot_graph,
24
  inputs=gr.File(label="Upload CSV File"),
25
+ outputs=gr.Image(type="filepath", label="Generated Graph"),
26
  title="Tabular Data Plotter"
27
  )
28