Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -2,24 +2,23 @@ import gradio as gr
|
|
| 2 |
import pandas as pd
|
| 3 |
from pycaret.classification import setup, compare_models, pull
|
| 4 |
|
| 5 |
-
def get_columns(dosya):
|
| 6 |
-
if dosya is None:
|
| 7 |
-
return gr.update(choices=[]), gr.update(choices=[]), gr.update(choices=[])
|
| 8 |
-
data = pd.read_csv(dosya.name)
|
| 9 |
-
kolonlar = data.columns.tolist()
|
| 10 |
-
return gr.update(choices=kolonlar), gr.update(choices=kolonlar), gr.update(choices=kolonlar)
|
| 11 |
-
|
| 12 |
def otoml_islemi(dosya, hedef_sutun, sayisal_sutunlar, kategorik_sutunlar,
|
| 13 |
-
sayisal_imputasyon, kategorik_imputasyon, normalize, remove_outliers):
|
| 14 |
# Veri setini yükleyin
|
| 15 |
data = pd.read_csv(dosya.name)
|
| 16 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
# PyCaret kurulumunu başlatın
|
| 18 |
s = setup(
|
| 19 |
data,
|
| 20 |
target=hedef_sutun,
|
| 21 |
-
numeric_features=sayisal_sutunlar
|
| 22 |
-
categorical_features=kategorik_sutunlar
|
|
|
|
| 23 |
numeric_imputation=sayisal_imputasyon,
|
| 24 |
categorical_imputation=kategorik_imputasyon,
|
| 25 |
normalize=normalize,
|
|
@@ -36,29 +35,21 @@ def otoml_islemi(dosya, hedef_sutun, sayisal_sutunlar, kategorik_sutunlar,
|
|
| 36 |
|
| 37 |
return degerlendirme
|
| 38 |
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
buton.click(
|
| 58 |
-
fn=otoml_islemi,
|
| 59 |
-
inputs=[dosya, hedef_sutun, sayisal_sutunlar, kategorik_sutunlar,
|
| 60 |
-
sayisal_imputasyon, kategorik_imputasyon, normalize, remove_outliers],
|
| 61 |
-
outputs=cikti
|
| 62 |
-
)
|
| 63 |
-
|
| 64 |
-
demo.launch()
|
|
|
|
| 2 |
import pandas as pd
|
| 3 |
from pycaret.classification import setup, compare_models, pull
|
| 4 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
def otoml_islemi(dosya, hedef_sutun, sayisal_sutunlar, kategorik_sutunlar,
|
| 6 |
+
sayisal_imputasyon, kategorik_imputasyon, normalize, remove_outliers, ignore_sutunlar):
|
| 7 |
# Veri setini yükleyin
|
| 8 |
data = pd.read_csv(dosya.name)
|
| 9 |
|
| 10 |
+
# Sütunları listeye dönüştürün
|
| 11 |
+
sayisal_sutunlar = [col.strip() for col in sayisal_sutunlar.split(',')] if sayisal_sutunlar else None
|
| 12 |
+
kategorik_sutunlar = [col.strip() for col in kategorik_sutunlar.split(',')] if kategorik_sutunlar else None
|
| 13 |
+
ignore_sutunlar = [col.strip() for col in ignore_sutunlar.split(',')] if ignore_sutunlar else None
|
| 14 |
+
|
| 15 |
# PyCaret kurulumunu başlatın
|
| 16 |
s = setup(
|
| 17 |
data,
|
| 18 |
target=hedef_sutun,
|
| 19 |
+
numeric_features=sayisal_sutunlar,
|
| 20 |
+
categorical_features=kategorik_sutunlar,
|
| 21 |
+
ignore_features=ignore_sutunlar,
|
| 22 |
numeric_imputation=sayisal_imputasyon,
|
| 23 |
categorical_imputation=kategorik_imputasyon,
|
| 24 |
normalize=normalize,
|
|
|
|
| 35 |
|
| 36 |
return degerlendirme
|
| 37 |
|
| 38 |
+
# Gradio arayüzü
|
| 39 |
+
gr.Interface(
|
| 40 |
+
otoml_islemi,
|
| 41 |
+
inputs=[
|
| 42 |
+
gr.inputs.File(label="Veri Seti (CSV)"),
|
| 43 |
+
gr.inputs.Textbox(label="Hedef Sütun Adı"),
|
| 44 |
+
gr.inputs.Textbox(label="Sayısal Sütunlar (Virgülle Ayrılmış)"),
|
| 45 |
+
gr.inputs.Textbox(label="Kategorik Sütunlar (Virgülle Ayrılmış)"),
|
| 46 |
+
gr.inputs.Textbox(label="Görmezden Gelinecek Sütunlar (Virgülle Ayrılmış)"),
|
| 47 |
+
gr.inputs.Dropdown(label="Sayısal İmputasyon Yöntemi", choices=['mean', 'median', 'zero'], default='mean'),
|
| 48 |
+
gr.inputs.Dropdown(label="Kategorik İmputasyon Yöntemi", choices=['mode', 'constant'], default='mode'),
|
| 49 |
+
gr.inputs.Checkbox(label="Normalize Et", default=False),
|
| 50 |
+
gr.inputs.Checkbox(label="Aykırı Değerleri Kaldır", default=False)
|
| 51 |
+
],
|
| 52 |
+
outputs=gr.outputs.Dataframe(label="Model Değerlendirme Sonuçları"),
|
| 53 |
+
title="PyCaret ile AutoML Arayüzü",
|
| 54 |
+
description="Veri setinizi yükleyin, sütun türlerini ve veri ön işleme adımlarını seçin, ardından en iyi modeli belirleyin."
|
| 55 |
+
).launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|