Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -3,7 +3,7 @@
|
|
| 3 |
# !pip install gradio
|
| 4 |
|
| 5 |
import gradio as gr
|
| 6 |
-
import
|
| 7 |
import pandas as pd
|
| 8 |
import os
|
| 9 |
|
|
@@ -40,11 +40,8 @@ def show_pie_chart(): # Define the function to show the pie chart
|
|
| 40 |
labels = ['Remaining Income', 'Expenses']
|
| 41 |
sizes = [remaining_income, total_expenses]
|
| 42 |
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
ax.axis('equal') # Equal aspect ratio ensures that pie is drawn as a circle.
|
| 46 |
-
|
| 47 |
-
plt.close(fig) # Prevents the figure from displaying in a separate window
|
| 48 |
return fig # Return the figure to be displayed in Gradio
|
| 49 |
|
| 50 |
def reset_data(): # Define the reset_data function
|
|
|
|
| 3 |
# !pip install gradio
|
| 4 |
|
| 5 |
import gradio as gr
|
| 6 |
+
import plotly.graph_objects as go # Import plotly for plotting
|
| 7 |
import pandas as pd
|
| 8 |
import os
|
| 9 |
|
|
|
|
| 40 |
labels = ['Remaining Income', 'Expenses']
|
| 41 |
sizes = [remaining_income, total_expenses]
|
| 42 |
|
| 43 |
+
# Create a pie chart using plotly
|
| 44 |
+
fig = go.Figure(data=[go.Pie(labels=labels, values=sizes, hole=.3)]) # Create a pie chart
|
|
|
|
|
|
|
|
|
|
| 45 |
return fig # Return the figure to be displayed in Gradio
|
| 46 |
|
| 47 |
def reset_data(): # Define the reset_data function
|