Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -10,7 +10,7 @@ from sklearn.compose import ColumnTransformer
|
|
10 |
from sklearn.linear_model import LogisticRegression
|
11 |
|
12 |
# ----------------------------
|
13 |
-
#
|
14 |
# ----------------------------
|
15 |
|
16 |
df = pd.read_csv("Testdaten_Mersen_kompatibel.csv", sep=";", encoding="utf-8-sig")
|
@@ -28,7 +28,7 @@ else:
|
|
28 |
raise ValueError("Spalte 'Anfrage_Datum' nicht gefunden. Verfügbare Spalten: " + str(df.columns.tolist()))
|
29 |
|
30 |
# ----------------------------
|
31 |
-
#
|
32 |
# ----------------------------
|
33 |
|
34 |
X = df[[
|
@@ -43,7 +43,7 @@ text_feature = "Anfrage_Text"
|
|
43 |
numeric_feature = "Projektgröße (€)"
|
44 |
|
45 |
# ----------------------------
|
46 |
-
#
|
47 |
# ----------------------------
|
48 |
|
49 |
preprocessor = ColumnTransformer([
|
@@ -60,7 +60,7 @@ pipeline = Pipeline([
|
|
60 |
pipeline.fit(X, y)
|
61 |
|
62 |
# ----------------------------
|
63 |
-
#
|
64 |
# ----------------------------
|
65 |
|
66 |
def predict_lead(kundentyp, branche, produktgruppe, region, kanal,
|
@@ -84,7 +84,7 @@ def predict_lead(kundentyp, branche, produktgruppe, region, kanal,
|
|
84 |
return f"Abschlusswahrscheinlichkeit: {prob:.2f} → Priorität: {klasse.upper()}"
|
85 |
|
86 |
# ----------------------------
|
87 |
-
#
|
88 |
# ----------------------------
|
89 |
|
90 |
demo = gr.Interface(
|
|
|
10 |
from sklearn.linear_model import LogisticRegression
|
11 |
|
12 |
# ----------------------------
|
13 |
+
# CSV laden und Spalten bereinigen
|
14 |
# ----------------------------
|
15 |
|
16 |
df = pd.read_csv("Testdaten_Mersen_kompatibel.csv", sep=";", encoding="utf-8-sig")
|
|
|
28 |
raise ValueError("Spalte 'Anfrage_Datum' nicht gefunden. Verfügbare Spalten: " + str(df.columns.tolist()))
|
29 |
|
30 |
# ----------------------------
|
31 |
+
# Features & Ziel definieren
|
32 |
# ----------------------------
|
33 |
|
34 |
X = df[[
|
|
|
43 |
numeric_feature = "Projektgröße (€)"
|
44 |
|
45 |
# ----------------------------
|
46 |
+
# Modell-Pipeline
|
47 |
# ----------------------------
|
48 |
|
49 |
preprocessor = ColumnTransformer([
|
|
|
60 |
pipeline.fit(X, y)
|
61 |
|
62 |
# ----------------------------
|
63 |
+
# Vorhersagefunktion
|
64 |
# ----------------------------
|
65 |
|
66 |
def predict_lead(kundentyp, branche, produktgruppe, region, kanal,
|
|
|
84 |
return f"Abschlusswahrscheinlichkeit: {prob:.2f} → Priorität: {klasse.upper()}"
|
85 |
|
86 |
# ----------------------------
|
87 |
+
# Gradio UI
|
88 |
# ----------------------------
|
89 |
|
90 |
demo = gr.Interface(
|