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

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -13
app.py CHANGED
@@ -209,7 +209,6 @@ 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️ Dosya yükle ve tahmin butonu
213
  with gr.Row():
214
  file_in = gr.File(
215
  file_types=[".xlsx", ".xls", ".xlsm"],
@@ -217,7 +216,6 @@ 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 dosyalar
221
  gr.Examples(
222
  examples=EXAMPLE_XLSX,
223
  inputs=file_in,
@@ -225,29 +223,36 @@ with gr.Blocks(theme=gr.themes.Default(primary_hue="blue")) as demo:
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()
 
209
  with gr.Blocks(theme=gr.themes.Default(primary_hue="blue")) as demo:
210
  gr.Markdown("# Denetçi Görüşü Tahmin Uygulaması")
211
 
 
212
  with gr.Row():
213
  file_in = gr.File(
214
  file_types=[".xlsx", ".xls", ".xlsm"],
 
216
  )
217
  btn = gr.Button("Tahmin Et", variant="primary")
218
 
 
219
  gr.Examples(
220
  examples=EXAMPLE_XLSX,
221
  inputs=file_in,
 
223
  cache_examples=False,
224
  )
225
 
226
+ status = gr.Markdown(visible=False) # Yükleniyor mesajı
227
+
228
+ # Sonuç tablosu (stil ile yüksekliği yönetilecek)
229
  out_df = gr.Dataframe(
230
  wrap=True,
231
  show_label=False,
232
  visible=True,
233
+ render=False # İlk başta gizli olsun
234
  )
235
 
236
+ # CSS ile tablo yüksekliğini kontrol et, scroll’u kaldır
237
+ gr.HTML("""
238
+ <style>
239
+ .scroll-hide table {
240
+ max-height: none !important;
241
+ overflow: visible !important;
242
+ }
243
+ </style>
244
+ """)
245
+
246
+ # Fonksiyon: yükleme durumu + tahmin
247
  def with_status(file):
248
  status.update(value="⏳ Tahmin ediliyor...", visible=True)
249
  df = predict_opinion(file)
250
  status.update(visible=False)
251
+ return gr.update(value=df, visible=True)
252
 
253
  btn.click(
254
  fn=with_status,
255
  inputs=file_in,
256
+ outputs=[out_df],
257
+ show_progress=True
258
  )