Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -64,34 +64,21 @@ def generate_gantt():
|
|
64 |
if not campaigns:
|
65 |
return "<i>Keine Kampagnen zum Anzeigen</i>"
|
66 |
|
67 |
-
# Kampagnen-Daten in ein DataFrame umwandeln
|
68 |
df = pd.DataFrame(campaigns)
|
69 |
df["Start"] = pd.to_datetime(df["Start"])
|
70 |
df["Ende"] = pd.to_datetime(df["Ende"])
|
71 |
|
72 |
try:
|
73 |
-
|
74 |
-
fig = px.timeline(
|
75 |
-
df,
|
76 |
-
x_start="Start",
|
77 |
-
x_end="Ende",
|
78 |
-
y="Name",
|
79 |
-
color="Verantwortlich",
|
80 |
-
title="📊 Kampagnenübersicht"
|
81 |
-
)
|
82 |
fig.update_yaxes(autorange="reversed")
|
83 |
-
fig.update_layout(
|
84 |
-
height=400,
|
85 |
-
margin=dict(l=20, r=20, t=30, b=20)
|
86 |
-
)
|
87 |
|
88 |
# Diagramm als HTML exportieren
|
89 |
html = pio.to_html(fig, full_html=False, include_plotlyjs='cdn')
|
90 |
-
return html
|
91 |
except Exception as e:
|
92 |
return f"<b>Fehler:</b> {e}"
|
93 |
|
94 |
-
|
95 |
with gr.Blocks() as app:
|
96 |
# Startseite
|
97 |
with gr.Column(visible=True) as start_page:
|
@@ -171,4 +158,4 @@ with gr.Blocks() as app:
|
|
171 |
# Gantt aktualisieren
|
172 |
update_chart.click(generate_gantt, outputs=gantt_html)
|
173 |
|
174 |
-
app.launch(share=True)
|
|
|
64 |
if not campaigns:
|
65 |
return "<i>Keine Kampagnen zum Anzeigen</i>"
|
66 |
|
|
|
67 |
df = pd.DataFrame(campaigns)
|
68 |
df["Start"] = pd.to_datetime(df["Start"])
|
69 |
df["Ende"] = pd.to_datetime(df["Ende"])
|
70 |
|
71 |
try:
|
72 |
+
fig = px.timeline(df, x_start="Start", x_end="Ende", y="Name", color="Verantwortlich", title="📊 Kampagnenübersicht")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
73 |
fig.update_yaxes(autorange="reversed")
|
74 |
+
fig.update_layout(height=400, margin=dict(l=20, r=20, t=30, b=20))
|
|
|
|
|
|
|
75 |
|
76 |
# Diagramm als HTML exportieren
|
77 |
html = pio.to_html(fig, full_html=False, include_plotlyjs='cdn')
|
78 |
+
return html
|
79 |
except Exception as e:
|
80 |
return f"<b>Fehler:</b> {e}"
|
81 |
|
|
|
82 |
with gr.Blocks() as app:
|
83 |
# Startseite
|
84 |
with gr.Column(visible=True) as start_page:
|
|
|
158 |
# Gantt aktualisieren
|
159 |
update_chart.click(generate_gantt, outputs=gantt_html)
|
160 |
|
161 |
+
app.launch(share=True)
|