charliebaby2023 commited on
Commit
2a1a6bb
1 Parent(s): 9ba5fbc

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -14
app.py CHANGED
@@ -21,7 +21,7 @@ def load_fn(models):
21
  try:
22
  m = gr.load(f'models/{model}')
23
  except Exception as error:
24
- m = gr.Interface()
25
  models_load.update({model: m})
26
 
27
  load_fn(models)
@@ -75,19 +75,6 @@ def make_me():
75
  </p>
76
  """)
77
 
78
- # Custom JavaScript to prevent auto-scrolling on error toast
79
- js_code = """
80
- document.addEventListener('DOMContentLoaded', function() {
81
- const observer = new MutationObserver(function(mutations) {
82
- for (let mutation of mutations) {
83
- if (mutation.addedNodes.length && mutation.addedNodes[0].classList.contains('alert')) {
84
- window.scrollTo({top: 50%});
85
- }
86
- }
87
- });
88
- observer.observe(document.body, { childList: true, subtree: true });
89
- });
90
- """
91
 
92
  with gr.Blocks(css=".toast-wrap {position:absolute!important; bottom:0%!important; top:auto!important; display:none!important; }") as demo:
93
  gr.Markdown("<script>" + js_code + "</script>")
 
21
  try:
22
  m = gr.load(f'models/{model}')
23
  except Exception as error:
24
+ return None
25
  models_load.update({model: m})
26
 
27
  load_fn(models)
 
75
  </p>
76
  """)
77
 
 
 
 
 
 
 
 
 
 
 
 
 
 
78
 
79
  with gr.Blocks(css=".toast-wrap {position:absolute!important; bottom:0%!important; top:auto!important; display:none!important; }") as demo:
80
  gr.Markdown("<script>" + js_code + "</script>")