Fixed the session clean-up by work-around for Gradio bug #12159 (https://github.com/gradio-app/gradio/issues/12159).
Browse files
app.py
CHANGED
|
@@ -385,8 +385,6 @@ with gradio.Blocks(css = css,
|
|
| 385 |
# ====== Session handling ================================================
|
| 386 |
# Session initialization, to be called when page is loaded
|
| 387 |
gui.load(initializeSession)
|
| 388 |
-
# Session clean-up, to be called when page is closed/refreshed
|
| 389 |
-
gui.unload(cleanUpSession)
|
| 390 |
|
| 391 |
# ====== Header ==========================================================
|
| 392 |
with gradio.Row(height = '10vh', min_height = '10vh', max_height = '10vh'):
|
|
@@ -479,6 +477,13 @@ with gradio.Blocks(css = css,
|
|
| 479 |
outputs = [ outputGallery, analysisOutput ]
|
| 480 |
)
|
| 481 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 482 |
# ====== Run the GUI ========================================================
|
| 483 |
if __name__ == "__main__":
|
| 484 |
|
|
|
|
| 385 |
# ====== Session handling ================================================
|
| 386 |
# Session initialization, to be called when page is loaded
|
| 387 |
gui.load(initializeSession)
|
|
|
|
|
|
|
| 388 |
|
| 389 |
# ====== Header ==========================================================
|
| 390 |
with gradio.Row(height = '10vh', min_height = '10vh', max_height = '10vh'):
|
|
|
|
| 477 |
outputs = [ outputGallery, analysisOutput ]
|
| 478 |
)
|
| 479 |
|
| 480 |
+
# ====== Session handling ================================================
|
| 481 |
+
# Session clean-up, to be called when page is closed/refreshed.
|
| 482 |
+
# This must be the last statement of gr.Blocks(), due to bug #12159!
|
| 483 |
+
# -> https://github.com/gradio-app/gradio/issues/12159
|
| 484 |
+
gui.unload(cleanUpSession)
|
| 485 |
+
|
| 486 |
+
|
| 487 |
# ====== Run the GUI ========================================================
|
| 488 |
if __name__ == "__main__":
|
| 489 |
|