buraktrk commited on
Commit
b611fd5
·
verified ·
1 Parent(s): 46a39f9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -10
app.py CHANGED
@@ -209,7 +209,7 @@ def predict_opinion(excel_file: gr.File):
209
  with gr.Blocks(theme=gr.themes.Default(primary_hue="blue")) as demo:
210
  gr.Markdown("# Denetçi Görüşü Tahmin Uygulaması")
211
 
212
- # 1️ Üst: Dosya yükle ve buton
213
  with gr.Row():
214
  file_in = gr.File(
215
  file_types=[".xlsx", ".xls", ".xlsm"],
@@ -217,7 +217,7 @@ with gr.Blocks(theme=gr.themes.Default(primary_hue="blue")) as demo:
217
  )
218
  btn = gr.Button("Tahmin Et", variant="primary")
219
 
220
- # 2️ Örnek Excel dosyaları
221
  gr.Examples(
222
  examples=EXAMPLE_XLSX,
223
  inputs=file_in,
@@ -225,23 +225,29 @@ with gr.Blocks(theme=gr.themes.Default(primary_hue="blue")) as demo:
225
  cache_examples=False,
226
  )
227
 
228
- # 3️ Çıktılar (başta görünmesin)
229
  out_df = gr.Dataframe(
230
  wrap=True,
231
  show_label=False,
232
- visible=False # 🔥 Bu satır önemli
 
233
  )
234
 
235
- # 4️ Tahmin fonksiyonu
236
- def predict_opinion_with_visibility(excel_file: gr.File):
237
- df_result = predict_opinion(excel_file) # senin mevcut fonksiyonun
238
- return gr.update(value=df_result, visible=True)
 
 
 
 
 
239
 
240
  btn.click(
241
- predict_opinion_with_visibility,
242
  inputs=file_in,
243
  outputs=out_df
244
  )
245
 
246
  if __name__ == "__main__":
247
- demo.launch()
 
209
  with gr.Blocks(theme=gr.themes.Default(primary_hue="blue")) as demo:
210
  gr.Markdown("# Denetçi Görüşü Tahmin Uygulaması")
211
 
212
+ # 1️ Dosya yükle ve tahmin butonu
213
  with gr.Row():
214
  file_in = gr.File(
215
  file_types=[".xlsx", ".xls", ".xlsm"],
 
217
  )
218
  btn = gr.Button("Tahmin Et", variant="primary")
219
 
220
+ # 2️ Örnek dosyalar
221
  gr.Examples(
222
  examples=EXAMPLE_XLSX,
223
  inputs=file_in,
 
225
  cache_examples=False,
226
  )
227
 
228
+ # 3️ Çıktı tablosu (scroll yok, tüm satırlar görünsün)
229
  out_df = gr.Dataframe(
230
  wrap=True,
231
  show_label=False,
232
+ visible=True,
233
+ height=300 # Sabit yükseklik
234
  )
235
 
236
+ # 4️ Yükleniyor animasyonu eklendi
237
+ with gr.Row():
238
+ status = gr.Markdown(visible=False)
239
+
240
+ def with_status(file):
241
+ status.update(value="⏳ Tahmin ediliyor...", visible=True)
242
+ df = predict_opinion(file)
243
+ status.update(visible=False)
244
+ return df
245
 
246
  btn.click(
247
+ fn=with_status,
248
  inputs=file_in,
249
  outputs=out_df
250
  )
251
 
252
  if __name__ == "__main__":
253
+ demo.launch()