buraktrk commited on
Commit
52d95e9
·
verified ·
1 Parent(s): 5cb1006

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +27 -5
app.py CHANGED
@@ -4,6 +4,18 @@ from sklearn.preprocessing import MinMaxScaler, LabelEncoder
4
  from sklearn.metrics import accuracy_score
5
  from concrete.ml.sklearn import XGBClassifier as ConcreteXGBClassifier
6
 
 
 
 
 
 
 
 
 
 
 
 
 
7
  SELECTED_FEATS = [
8
  "Cari Oran",
9
  "Dönen Varlıklar / Aktif (%)",
@@ -190,13 +202,23 @@ def predict_opinion(excel_file: gr.File):
190
  labels = encoder.inverse_transform(y_pred)
191
  return pd.DataFrame({"Tahmin Görüş Tipi": labels})
192
 
193
- # ------------------------ Gradio UI ------------------------
194
  with gr.Blocks(theme=gr.themes.Default(primary_hue="blue")) as demo:
195
  gr.Markdown("# Denetçi Görüşü Tahmin Uygulaması")
196
- file_in = gr.File(file_types=[".xlsx", ".xls", ".xlsm"], label="Excel Yükleyin")
197
- btn = gr.Button("Tahmin Et", variant="primary")
198
- out_df = gr.Dataframe(wrap=True, show_label=False)
 
 
 
 
 
 
 
 
 
 
199
  btn.click(predict_opinion, file_in, out_df)
200
 
201
  if __name__ == "__main__":
202
- demo.launch()
 
4
  from sklearn.metrics import accuracy_score
5
  from concrete.ml.sklearn import XGBClassifier as ConcreteXGBClassifier
6
 
7
+
8
+ # Örnek dosyalar
9
+ SAMPLE_DIR = "Sample Inputs (Excel)"
10
+ EXAMPLE_XLSX = [
11
+ f"{SAMPLE_DIR}/ROYAL_2019.xlsx",
12
+ f"{SAMPLE_DIR}/MARKA_2016.xlsx",
13
+ f"{SAMPLE_DIR}/THYAO_2023.xlsx",
14
+ f"{SAMPLE_DIR}/TTRAK_2024.xlsx"
15
+ ]
16
+
17
+
18
+
19
  SELECTED_FEATS = [
20
  "Cari Oran",
21
  "Dönen Varlıklar / Aktif (%)",
 
202
  labels = encoder.inverse_transform(y_pred)
203
  return pd.DataFrame({"Tahmin Görüş Tipi": labels})
204
 
205
+ # Gradio UI
206
  with gr.Blocks(theme=gr.themes.Default(primary_hue="blue")) as demo:
207
  gr.Markdown("# Denetçi Görüşü Tahmin Uygulaması")
208
+
209
+ with gr.Row():
210
+ file_in = gr.File(file_types=[".xlsx", ".xls", ".xlsm"], label="Excel Yükleyin")
211
+ btn = gr.Button("Tahmin Et", variant="primary")
212
+
213
+ gr.Examples(
214
+ examples=EXAMPLE_XLSX,
215
+ inputs=file_in,
216
+ label="Örnek Dosyayı Deneyin",
217
+ cache_examples=False,
218
+ )
219
+
220
+ out_df = gr.Dataframe(wrap=True, show_label=False, row_count=0)
221
  btn.click(predict_opinion, file_in, out_df)
222
 
223
  if __name__ == "__main__":
224
+ demo.launch()