Spaces:
Runtime error
Runtime error
Update app.py
Browse files
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️
|
| 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️
|
| 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️
|
| 229 |
out_df = gr.Dataframe(
|
| 230 |
wrap=True,
|
| 231 |
show_label=False,
|
| 232 |
-
visible=
|
|
|
|
| 233 |
)
|
| 234 |
|
| 235 |
-
# 4️
|
| 236 |
-
|
| 237 |
-
|
| 238 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 239 |
|
| 240 |
btn.click(
|
| 241 |
-
|
| 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()
|