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

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -9
app.py CHANGED
@@ -205,11 +205,11 @@ def predict_opinion(excel_file: gr.File):
205
  "Tahmin Görüş Tipi": labels})
206
 
207
 
208
- # Gradio UI
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,14 +225,23 @@ with gr.Blocks(theme=gr.themes.Default(primary_hue="blue")) as demo:
225
  cache_examples=False,
226
  )
227
 
228
- # 3 Sonuçlar tablosu
229
  out_df = gr.Dataframe(
230
- wrap=True,
231
- show_label=False,
232
- visible=True
 
 
 
 
 
 
 
 
 
 
 
233
  )
234
- # 4️ Tahmin fonksiyonu bağla
235
- btn.click(predict_opinion, inputs=file_in, outputs=out_df)
236
 
237
  if __name__ == "__main__":
238
  demo.launch()
 
205
  "Tahmin Görüş Tipi": labels})
206
 
207
 
208
+ # Gradio UI
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
  )
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
  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()