Spaces:
Sleeping
Sleeping
Edgar Garcia
commited on
Commit
·
b956fda
1
Parent(s):
8697904
translation
Browse files- app.py +12 -12
- dataframe_processing.py +2 -2
- utils.py +3 -3
app.py
CHANGED
@@ -59,32 +59,32 @@ def show_plots():
|
|
59 |
|
60 |
|
61 |
with gr.Blocks() as demo:
|
62 |
-
gr.Markdown("
|
63 |
|
64 |
-
with gr.Tab("
|
65 |
with gr.Row():
|
66 |
-
concept = gr.Textbox(label="
|
67 |
with gr.Row():
|
68 |
-
amount= gr.Textbox(label="
|
69 |
-
btn_manual = gr.Button("
|
70 |
|
71 |
-
with gr.Tab("
|
72 |
with gr.Row():
|
73 |
input_image = gr.Image( type="pil")
|
74 |
-
btn_image = gr.Button("
|
75 |
|
76 |
|
77 |
|
78 |
|
79 |
|
80 |
with gr.Row():
|
81 |
-
btn_show = gr.Button("
|
82 |
|
83 |
with gr.Row():
|
84 |
-
expense_class= gr.Textbox(label='
|
85 |
-
ui_date=gr.Textbox(label='
|
86 |
-
expenses_today= gr.Textbox(label='
|
87 |
-
expenses_this_week= gr.Textbox(label='
|
88 |
with gr.Row():
|
89 |
daily_plot=gr.Plot(label=None)
|
90 |
week_plot=gr.Plot()
|
|
|
59 |
|
60 |
|
61 |
with gr.Blocks() as demo:
|
62 |
+
gr.Markdown("Tracker de gastos")
|
63 |
|
64 |
+
with gr.Tab("Entrada manual"):
|
65 |
with gr.Row():
|
66 |
+
concept = gr.Textbox(label="Concepto")
|
67 |
with gr.Row():
|
68 |
+
amount= gr.Textbox(label="Monto")
|
69 |
+
btn_manual = gr.Button("Ingresar gasto")
|
70 |
|
71 |
+
with gr.Tab("Cargar recibo"):
|
72 |
with gr.Row():
|
73 |
input_image = gr.Image( type="pil")
|
74 |
+
btn_image = gr.Button("Ingresar gasto")
|
75 |
|
76 |
|
77 |
|
78 |
|
79 |
|
80 |
with gr.Row():
|
81 |
+
btn_show = gr.Button("Mostrar graficos")
|
82 |
|
83 |
with gr.Row():
|
84 |
+
expense_class= gr.Textbox(label='Clase de gasto')
|
85 |
+
ui_date=gr.Textbox(label='Fecha')
|
86 |
+
expenses_today= gr.Textbox(label='Gastos de hoy')
|
87 |
+
expenses_this_week= gr.Textbox(label='Gastos esta semana')
|
88 |
with gr.Row():
|
89 |
daily_plot=gr.Plot(label=None)
|
90 |
week_plot=gr.Plot()
|
dataframe_processing.py
CHANGED
@@ -31,12 +31,12 @@ def dataframe_process(sheet):
|
|
31 |
weekly_df['week'] = weekly_df['week'].astype(str)
|
32 |
weekly_df['week']=weekly_df['week'].apply(lambda x: re.sub(r'\d{4}-', '', x))
|
33 |
|
34 |
-
fig2 = create_barplot(weekly_df['week'],weekly_df['amount'],"
|
35 |
|
36 |
|
37 |
#Per category
|
38 |
expenses_per_category=df[['concept','amount','category']].groupby('category').sum().reset_index()
|
39 |
expenses_per_category=expenses_per_category.sort_values(by='amount', ascending=False)
|
40 |
-
fig3 = create_barplot(expenses_per_category['category'],expenses_per_category['amount'],"
|
41 |
|
42 |
return day_month, todays_amount, current_week_amount , fig, fig2, fig3
|
|
|
31 |
weekly_df['week'] = weekly_df['week'].astype(str)
|
32 |
weekly_df['week']=weekly_df['week'].apply(lambda x: re.sub(r'\d{4}-', '', x))
|
33 |
|
34 |
+
fig2 = create_barplot(weekly_df['week'],weekly_df['amount'],"semana","monto","gasto por semana")
|
35 |
|
36 |
|
37 |
#Per category
|
38 |
expenses_per_category=df[['concept','amount','category']].groupby('category').sum().reset_index()
|
39 |
expenses_per_category=expenses_per_category.sort_values(by='amount', ascending=False)
|
40 |
+
fig3 = create_barplot(expenses_per_category['category'],expenses_per_category['amount'],"categoria","monto","gasto por categoria")
|
41 |
|
42 |
return day_month, todays_amount, current_week_amount , fig, fig2, fig3
|
utils.py
CHANGED
@@ -12,9 +12,9 @@ def create_plot(x, y):
|
|
12 |
ax.plot(x, y, marker='o')
|
13 |
for i in range(len(x)):
|
14 |
ax.text(x[i], y[i], f'{y[i]:.2f}', fontsize=10, ha='left', va='bottom')
|
15 |
-
ax.set_xlabel('
|
16 |
-
ax.set_ylabel('
|
17 |
-
ax.set_title('
|
18 |
ax.set_xticks(x[::5]) # Show every 5th day
|
19 |
ax.set_xticklabels(x[::5], rotation=45, ha='right')
|
20 |
plt.xticks(rotation=30)
|
|
|
12 |
ax.plot(x, y, marker='o')
|
13 |
for i in range(len(x)):
|
14 |
ax.text(x[i], y[i], f'{y[i]:.2f}', fontsize=10, ha='left', va='bottom')
|
15 |
+
ax.set_xlabel('Dinero')
|
16 |
+
ax.set_ylabel('Gasto')
|
17 |
+
ax.set_title('Gasto diario')
|
18 |
ax.set_xticks(x[::5]) # Show every 5th day
|
19 |
ax.set_xticklabels(x[::5], rotation=45, ha='right')
|
20 |
plt.xticks(rotation=30)
|