Spaces:
Sleeping
Sleeping
Update app.py
Browse files
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 |
-
|
| 17 |
-
|
|
|
|
|
|
|
| 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="
|
| 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 |
|