Update app.py
Browse files
app.py
CHANGED
@@ -4,43 +4,43 @@ import pandas as pd
|
|
4 |
|
5 |
st.set_page_config(page_title="CSV 067 Analyst", layout="wide")
|
6 |
|
7 |
-
st.title("CSV 067 Analyst |
|
8 |
-
st.header("
|
9 |
|
10 |
-
#
|
11 |
-
data = st.file_uploader("
|
12 |
-
query = st.text_area("
|
13 |
|
14 |
if data is not None:
|
15 |
try:
|
16 |
-
#
|
17 |
df = pd.read_csv(data)
|
18 |
-
st.success("✅
|
19 |
|
20 |
-
#
|
21 |
-
st.subheader("
|
22 |
col1, col2 = st.columns(2)
|
23 |
with col1:
|
24 |
-
st.write(f"
|
25 |
with col2:
|
26 |
-
st.write(f"
|
27 |
|
28 |
-
#
|
29 |
-
if st.button("📊
|
30 |
if not query:
|
31 |
-
st.warning("⚠️
|
32 |
else:
|
33 |
-
with st.spinner("🔄 Analyse
|
34 |
try:
|
35 |
result = analyze_csv(df, query)
|
36 |
|
37 |
-
#
|
38 |
-
st.subheader("
|
39 |
st.write(result)
|
40 |
|
41 |
except Exception as e:
|
42 |
-
st.error(f"❌
|
43 |
|
44 |
except Exception as e:
|
45 |
-
st.error(f"❌
|
46 |
-
st.write("
|
|
|
4 |
|
5 |
st.set_page_config(page_title="CSV 067 Analyst", layout="wide")
|
6 |
|
7 |
+
st.title("CSV 067 Analyst | CSV-Dateianalyse")
|
8 |
+
st.header("Laden Sie hier Ihre CSV-Datei hoch:")
|
9 |
|
10 |
+
# CSV-Datei hochladen
|
11 |
+
data = st.file_uploader("CSV-Datei hochladen", type="csv")
|
12 |
+
query = st.text_area("Geben Sie Ihre Frage zu den Daten ein")
|
13 |
|
14 |
if data is not None:
|
15 |
try:
|
16 |
+
# CSV mit Fehlerbehandlung lesen
|
17 |
df = pd.read_csv(data)
|
18 |
+
st.success("✅ CSV-Datei erfolgreich geladen!")
|
19 |
|
20 |
+
# DataFrame-Informationen
|
21 |
+
st.subheader("Dateninformationen:")
|
22 |
col1, col2 = st.columns(2)
|
23 |
with col1:
|
24 |
+
st.write(f"Anzahl der Zeilen: {len(df)}")
|
25 |
with col2:
|
26 |
+
st.write(f"Anzahl der Spalten: {len(df.columns)}")
|
27 |
|
28 |
+
# Analyse-Button
|
29 |
+
if st.button("📊 Analysieren"):
|
30 |
if not query:
|
31 |
+
st.warning("⚠️ Bitte geben Sie eine Frage für die Analyse ein.")
|
32 |
else:
|
33 |
+
with st.spinner("🔄 Analyse läuft..."):
|
34 |
try:
|
35 |
result = analyze_csv(df, query)
|
36 |
|
37 |
+
# Ergebnisse anzeigen
|
38 |
+
st.subheader("Analyseergebnisse:")
|
39 |
st.write(result)
|
40 |
|
41 |
except Exception as e:
|
42 |
+
st.error(f"❌ Fehler bei der Analyse: {str(e)}")
|
43 |
|
44 |
except Exception as e:
|
45 |
+
st.error(f"❌ Fehler beim Lesen der Datei: {str(e)}")
|
46 |
+
st.write("Stellen Sie sicher, dass die Datei ein gültiges CSV-Format hat.")
|