DawnC commited on
Commit
f1d5120
·
verified ·
1 Parent(s): 4970f7d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +30 -29
app.py CHANGED
@@ -442,35 +442,34 @@ def show_details_html(choice, previous_output, initial_state):
442
  def get_pwa_html():
443
  return """
444
  <!DOCTYPE html>
445
- <meta charset="UTF-8">
446
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
447
- <meta name="apple-mobile-web-app-capable" content="yes">
448
- <meta name="apple-mobile-web-app-status-bar-style" content="black">
449
- <meta name="theme-color" content="#4299e1">
450
- <link rel="manifest" href="manifest.json">
451
- <link rel="apple-touch-icon" href="assets/icon-192.png">
452
-
453
- <script>
454
- // 簡化的 Service Worker 註冊
455
- document.addEventListener('DOMContentLoaded', function() {
456
- if ('serviceWorker' in navigator) {
457
- const swURL = new URL(
458
- 'service-worker.js',
459
- window.location.origin + window.location.pathname
460
- ).href;
461
-
462
- navigator.serviceWorker.register(swURL)
463
- .then(function(registration) {
464
- console.log('Service Worker 註冊成功,範圍:',
465
- registration.scope);
466
- })
467
- .catch(function(error) {
468
- console.log('Service Worker 註冊過程中發生錯誤:',
469
- error.message);
470
- });
471
- }
472
- });
473
- </script>
474
  """
475
 
476
  def main():
@@ -555,6 +554,8 @@ def main():
555
  </div>
556
  ''')
557
 
 
 
558
  return iface
559
 
560
  if __name__ == "__main__":
 
442
  def get_pwa_html():
443
  return """
444
  <!DOCTYPE html>
445
+ <html lang="en">
446
+ <head>
447
+ <meta charset="UTF-8" />
448
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
449
+ <meta name="apple-mobile-web-app-capable" content="yes">
450
+ <meta name="apple-mobile-web-app-status-bar-style" content="black">
451
+ <meta name="theme-color" content="#4299e1">
452
+
453
+ <link rel="manifest" href="manifest.json">
454
+ <link rel="apple-touch-icon" href="assets/icon-192.png">
455
+
456
+ <script>
457
+ // PWA: Service Worker 註冊
458
+ document.addEventListener('DOMContentLoaded', function() {
459
+ if ('serviceWorker' in navigator) {
460
+ const swURL = new URL('service-worker.js', window.location.origin + window.location.pathname).href;
461
+ navigator.serviceWorker.register(swURL)
462
+ .then(function(registration) {
463
+ console.log('Service Worker 註冊成功,範圍:', registration.scope);
464
+ })
465
+ .catch(function(error) {
466
+ console.log('Service Worker 註冊失敗:', error.message);
467
+ });
468
+ }
469
+ });
470
+ </script>
471
+ </head>
472
+ <body>
 
473
  """
474
 
475
  def main():
 
554
  </div>
555
  ''')
556
 
557
+ gr.HTML("</body></html>")
558
+
559
  return iface
560
 
561
  if __name__ == "__main__":