Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -2,23 +2,25 @@ import gradio as gr
|
|
| 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,
|
|
@@ -43,10 +45,12 @@ with gr.Blocks() as demo:
|
|
| 43 |
dosya = gr.File(label="Veri Seti (CSV)")
|
| 44 |
|
| 45 |
with gr.Row():
|
| 46 |
-
hedef_sutun = gr.
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
|
|
|
|
|
|
| 50 |
|
| 51 |
with gr.Row():
|
| 52 |
sayisal_imputasyon = gr.Dropdown(choices=['mean', 'median', 'zero'], label="Sayısal İmputasyon Yöntemi", value='mean')
|
|
@@ -60,8 +64,14 @@ with gr.Blocks() as demo:
|
|
| 60 |
|
| 61 |
output = gr.Dataframe(label="Model Değerlendirme Sonuçları")
|
| 62 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 63 |
buton.click(
|
| 64 |
-
otoml_islemi,
|
| 65 |
inputs=[dosya, hedef_sutun, sayisal_sutunlar, kategorik_sutunlar,
|
| 66 |
sayisal_imputasyon, kategorik_imputasyon, normalize, remove_outliers, ignore_sutunlar],
|
| 67 |
outputs=output
|
|
|
|
| 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, ignore_sutunlar):
|
| 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 if sayisal_sutunlar else None,
|
| 22 |
+
categorical_features=kategorik_sutunlar if kategorik_sutunlar else None,
|
| 23 |
+
ignore_features=ignore_sutunlar if ignore_sutunlar else None,
|
| 24 |
numeric_imputation=sayisal_imputasyon,
|
| 25 |
categorical_imputation=kategorik_imputasyon,
|
| 26 |
normalize=normalize,
|
|
|
|
| 45 |
dosya = gr.File(label="Veri Seti (CSV)")
|
| 46 |
|
| 47 |
with gr.Row():
|
| 48 |
+
hedef_sutun = gr.Dropdown(label="Hedef Sütun Adı", choices=[])
|
| 49 |
+
|
| 50 |
+
with gr.Row():
|
| 51 |
+
sayisal_sutunlar = gr.CheckboxGroup(label="Sayısal Sütunlar", choices=[])
|
| 52 |
+
kategorik_sutunlar = gr.CheckboxGroup(label="Kategorik Sütunlar", choices=[])
|
| 53 |
+
ignore_sutunlar = gr.CheckboxGroup(label="Görmezden Gelinecek Sütunlar", choices=[])
|
| 54 |
|
| 55 |
with gr.Row():
|
| 56 |
sayisal_imputasyon = gr.Dropdown(choices=['mean', 'median', 'zero'], label="Sayısal İmputasyon Yöntemi", value='mean')
|
|
|
|
| 64 |
|
| 65 |
output = gr.Dataframe(label="Model Değerlendirme Sonuçları")
|
| 66 |
|
| 67 |
+
dosya.change(
|
| 68 |
+
fn=get_columns,
|
| 69 |
+
inputs=dosya,
|
| 70 |
+
outputs=[hedef_sutun, sayisal_sutunlar, kategorik_sutunlar, ignore_sutunlar]
|
| 71 |
+
)
|
| 72 |
+
|
| 73 |
buton.click(
|
| 74 |
+
fn=otoml_islemi,
|
| 75 |
inputs=[dosya, hedef_sutun, sayisal_sutunlar, kategorik_sutunlar,
|
| 76 |
sayisal_imputasyon, kategorik_imputasyon, normalize, remove_outliers, ignore_sutunlar],
|
| 77 |
outputs=output
|