Nattapong Tapachoom commited on
Commit
da299cd
·
1 Parent(s): e5ac68d

Add model selection and row count functions for flexible processing

Browse files
Files changed (1) hide show
  1. app.py +21 -1
app.py CHANGED
@@ -1267,7 +1267,27 @@ def process_with_flexible_models(input_mode, single_model, suggested_model, mult
1267
  enable_cleaning, remove_duplicates, min_quality_score,
1268
  create_splits, export_format):
1269
  """Process generation with flexible model selection"""
1270
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1271
  # Get selected models
1272
  selected_models = get_selected_models(input_mode, single_model, suggested_model, multiple_models)
1273
 
 
1267
  enable_cleaning, remove_duplicates, min_quality_score,
1268
  create_splits, export_format):
1269
  """Process generation with flexible model selection"""
1270
+
1271
+ # ฟังก์ชันเลือกโมเดลที่ใช้จริง
1272
+ def get_selected_models(input_mode, single_model, suggested_model, multiple_models):
1273
+ if input_mode == "manual":
1274
+ return [single_model.strip()] if single_model and single_model.strip() else []
1275
+ elif input_mode == "suggested":
1276
+ return [suggested_model] if suggested_model else []
1277
+ elif input_mode == "multiple":
1278
+ # แยกชื่อโมเดลด้วย , และลบช่องว่าง
1279
+ return [m.strip() for m in multiple_models.split(",") if m.strip()]
1280
+ return []
1281
+
1282
+ # ฟังก์ชันนับจำนวนแถวข้อมูลที่ต้องการสร้าง
1283
+ def get_final_row_count(row_preset, custom_rows):
1284
+ try:
1285
+ if custom_rows and str(custom_rows).strip():
1286
+ return int(custom_rows)
1287
+ return int(row_preset)
1288
+ except Exception:
1289
+ return 10
1290
+
1291
  # Get selected models
1292
  selected_models = get_selected_models(input_mode, single_model, suggested_model, multiple_models)
1293