imorcillo commited on
Commit
b81c021
·
verified ·
1 Parent(s): 4caf1c5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -33
app.py CHANGED
@@ -273,39 +273,22 @@ with demo:
273
  )
274
 
275
  ###############################
276
- # Popup HTML
277
- gr.HTML("""
278
- <div id="popup-overlay" style="display: none;">
279
- <div id="popup-box">
280
- <h3>ℹ️ Notice</h3>
281
- <p>Grabaketak ez dira gordetzen eta automatikoki ezabatzen dira.<br>
282
- No se guardan las grabaciones y se eliminan automáticamente.<br>
283
- The recordings are not saved and are automatically removed.</p>
284
- <button id="popup-button">OK</button>
285
- </div>
286
- </div>
287
- """)
288
-
289
- # Inline JavaScript to show on load, hide on click
290
- gr.HTML("""
291
- <script>
292
- window.addEventListener('DOMContentLoaded', function () {
293
- const popup = document.getElementById("popup-overlay");
294
- const button = document.getElementById("popup-button");
295
-
296
- if (popup) {
297
- popup.style.display = "flex"; // Show popup explicitly
298
- }
299
-
300
- if (button) {
301
- button.onclick = () => {
302
- popup.style.display = "none"; // Hide popup on button click
303
- };
304
- }
305
- });
306
- </script>
307
- """)
308
- demo.load(fn=show_popup, outputs=popup)
309
  ###################
310
 
311
  gr.HTML("""
 
273
  )
274
 
275
  ###############################
276
+ # Modal component
277
+ popup_modal = gr.Column(visible=False, elem_id="popup-overlay")
278
+ with popup_modal:
279
+ gr.Markdown(
280
+ """
281
+ ### ℹ️ Notice
282
+
283
+ Grabaketak ez dira gordetzen eta automatikoki ezabatzen dira.
284
+ No se guardan las grabaciones y se eliminan automáticamente.
285
+ The recordings are not saved and are automatically removed.
286
+ """,
287
+ elem_id="popup-box"
288
+ )
289
+ ok_btn = gr.Button("OK", elem_id="popup-button")
290
+ ok_btn.click(fn=hide_popup, outputs=popup_modal)
291
+ demo.load(fn=show_popup, outputs=popup_modal)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
292
  ###################
293
 
294
  gr.HTML("""