Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -46,6 +46,13 @@ def add_campaign(name, goal, product, channel, start, end, budget, responsible):
|
|
| 46 |
total = df["Budget (CHF)"].sum()
|
| 47 |
return df, f"💰 Gesamtbudget: CHF {total:.2f}"
|
| 48 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 49 |
def export_csv():
|
| 50 |
df = pd.DataFrame(campaigns)
|
| 51 |
path = "kampagnen.csv"
|
|
@@ -98,8 +105,12 @@ with gr.Blocks() as app:
|
|
| 98 |
suggest_btn = gr.Button("💡 KI-Vorschlag")
|
| 99 |
idea = gr.Textbox(label="Kampagnenidee")
|
| 100 |
submit_btn = gr.Button("✅ Speichern")
|
|
|
|
|
|
|
| 101 |
output_table = gr.Dataframe()
|
| 102 |
budget_total = gr.Textbox(label="Budget Gesamt", interactive=False)
|
|
|
|
|
|
|
| 103 |
export_btn = gr.Button("📤 Export CSV")
|
| 104 |
csv_file = gr.File(label="📄 Herunterladen", interactive=False)
|
| 105 |
gr.Markdown("### 📈 Gantt-Visualisierung")
|
|
@@ -117,6 +128,7 @@ with gr.Blocks() as app:
|
|
| 117 |
login_btn.click(login, [user, pw], outputs=[start_page, login_page, planner_page, login_status])
|
| 118 |
suggest_btn.click(suggest_campaign, [product, goal, channel], idea)
|
| 119 |
submit_btn.click(add_campaign, [name, goal, product, channel, start, end, budget, responsible], [output_table, budget_total])
|
|
|
|
| 120 |
export_btn.click(export_csv, outputs=csv_file)
|
| 121 |
update_chart.click(generate_gantt, outputs=gantt_html)
|
| 122 |
|
|
|
|
| 46 |
total = df["Budget (CHF)"].sum()
|
| 47 |
return df, f"💰 Gesamtbudget: CHF {total:.2f}"
|
| 48 |
|
| 49 |
+
def delete_campaign(index):
|
| 50 |
+
if 0 <= index < len(campaigns):
|
| 51 |
+
del campaigns[index]
|
| 52 |
+
df = pd.DataFrame(campaigns)
|
| 53 |
+
total = df["Budget (CHF)"].sum() if not df.empty else 0
|
| 54 |
+
return df, f"💰 Gesamtbudget: CHF {total:.2f}"
|
| 55 |
+
|
| 56 |
def export_csv():
|
| 57 |
df = pd.DataFrame(campaigns)
|
| 58 |
path = "kampagnen.csv"
|
|
|
|
| 105 |
suggest_btn = gr.Button("💡 KI-Vorschlag")
|
| 106 |
idea = gr.Textbox(label="Kampagnenidee")
|
| 107 |
submit_btn = gr.Button("✅ Speichern")
|
| 108 |
+
delete_index = gr.Number(label="Index der Kampagne zum Löschen", precision=0)
|
| 109 |
+
delete_btn = gr.Button("🗑️ Kampagne löschen")
|
| 110 |
output_table = gr.Dataframe()
|
| 111 |
budget_total = gr.Textbox(label="Budget Gesamt", interactive=False)
|
| 112 |
+
delete_index = gr.Number(label="Index der Kampagne zum Löschen", precision=0)
|
| 113 |
+
delete_btn = gr.Button("🗑️ Kampagne löschen")
|
| 114 |
export_btn = gr.Button("📤 Export CSV")
|
| 115 |
csv_file = gr.File(label="📄 Herunterladen", interactive=False)
|
| 116 |
gr.Markdown("### 📈 Gantt-Visualisierung")
|
|
|
|
| 128 |
login_btn.click(login, [user, pw], outputs=[start_page, login_page, planner_page, login_status])
|
| 129 |
suggest_btn.click(suggest_campaign, [product, goal, channel], idea)
|
| 130 |
submit_btn.click(add_campaign, [name, goal, product, channel, start, end, budget, responsible], [output_table, budget_total])
|
| 131 |
+
delete_btn.click(delete_campaign, [delete_index], [output_table, budget_total])
|
| 132 |
export_btn.click(export_csv, outputs=csv_file)
|
| 133 |
update_chart.click(generate_gantt, outputs=gantt_html)
|
| 134 |
|