Surbhi commited on
Commit
295702b
·
1 Parent(s): 1ed90b8

Fix name error

Browse files
Files changed (1) hide show
  1. app.py +10 -9
app.py CHANGED
@@ -66,6 +66,16 @@ dataset_mapping = {
66
  dataset_path = dataset_mapping.get(problem, "datasets/spam_detection.csv")
67
  df = pd.read_csv(dataset_path)
68
 
 
 
 
 
 
 
 
 
 
 
69
  # Generated AI Code
70
  generated_code = f"""
71
  # AI Model Code
@@ -149,15 +159,6 @@ if task == "Classification":
149
  smote = SMOTE()
150
  X_train, y_train = smote.fit_resample(X_train, y_train)
151
 
152
- # Model Initialization
153
- model_mapping = {
154
- "KNN": KNeighborsClassifier() if task == "Classification" else KNeighborsRegressor(),
155
- "SVM": SVC() if task == "Classification" else SVR(),
156
- "Random Forest": RandomForestClassifier() if task == "Classification" else RandomForestRegressor(),
157
- "Decision Tree": DecisionTreeClassifier() if task == "Classification" else DecisionTreeRegressor(),
158
- "Perceptron": Perceptron()
159
- }
160
-
161
  model_instance = model_mapping[model]
162
 
163
  # Train Model
 
66
  dataset_path = dataset_mapping.get(problem, "datasets/spam_detection.csv")
67
  df = pd.read_csv(dataset_path)
68
 
69
+
70
+ # Model Initialization
71
+ model_mapping = {
72
+ "KNN": KNeighborsClassifier() if task == "Classification" else KNeighborsRegressor(),
73
+ "SVM": SVC() if task == "Classification" else SVR(),
74
+ "Random Forest": RandomForestClassifier() if task == "Classification" else RandomForestRegressor(),
75
+ "Decision Tree": DecisionTreeClassifier() if task == "Classification" else DecisionTreeRegressor(),
76
+ "Perceptron": Perceptron()
77
+ }
78
+
79
  # Generated AI Code
80
  generated_code = f"""
81
  # AI Model Code
 
159
  smote = SMOTE()
160
  X_train, y_train = smote.fit_resample(X_train, y_train)
161
 
 
 
 
 
 
 
 
 
 
162
  model_instance = model_mapping[model]
163
 
164
  # Train Model