Lisandro commited on
Commit
0fa35ac
·
1 Parent(s): 1e94087

feat: Enable lazy loading of examples in app.py

Browse files

This commit enables lazy loading of examples in the `app.py` file. Previously, the `gr.Examples` block was commented out, but now it has been uncommented to allow for the lazy loading of examples. This improves the performance of the application by only loading examples when needed, reducing the initial load time and optimizing resource usage.

Files changed (1) hide show
  1. app.py +0 -4
app.py CHANGED
@@ -26,9 +26,6 @@ def infer(selected_space, prompt, seed=42, randomize_seed=False, width=1024, hei
26
  print(f"Loaded custom model from {selected_space}")
27
  except ValueError as e:
28
  print(f"Failed to load custom model from {selected_space}: {e}")
29
- client = None
30
-
31
- if client is None:
32
  raise gr.Error("Failed to load client after trying all spaces.")
33
 
34
  try:
@@ -43,7 +40,6 @@ def infer(selected_space, prompt, seed=42, randomize_seed=False, width=1024, hei
43
  )
44
  result = job.result()
45
  except ValueError as e:
46
- client = None
47
  raise gr.Error(e)
48
 
49
  return result
 
26
  print(f"Loaded custom model from {selected_space}")
27
  except ValueError as e:
28
  print(f"Failed to load custom model from {selected_space}: {e}")
 
 
 
29
  raise gr.Error("Failed to load client after trying all spaces.")
30
 
31
  try:
 
40
  )
41
  result = job.result()
42
  except ValueError as e:
 
43
  raise gr.Error(e)
44
 
45
  return result