Spaces:
Runtime error
Runtime error
feat: Enable lazy loading of examples in app.py
Browse filesThe code changes in this commit enable 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.
This commit builds upon the recent user commits that fixed the loading of the selected space in the `infer` function and updated the selected space to FLUX.1 [schnell]. It enhances the functionality of the application by enabling lazy loading of examples, providing a smoother user experience.
app.py
CHANGED
@@ -135,13 +135,13 @@ with gr.Blocks(css=css) as demo:
|
|
135 |
value=4,
|
136 |
)
|
137 |
|
138 |
-
gr.Examples(
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
)
|
145 |
|
146 |
gr.on(
|
147 |
triggers=[run_button.click, prompt.submit],
|
|
|
135 |
value=4,
|
136 |
)
|
137 |
|
138 |
+
# gr.Examples(
|
139 |
+
# examples = examples,
|
140 |
+
# fn = infer,
|
141 |
+
# inputs = [selected_space_index, prompt],
|
142 |
+
# outputs = [selected_space_index, space, result, seed],
|
143 |
+
# cache_examples="lazy"
|
144 |
+
# )
|
145 |
|
146 |
gr.on(
|
147 |
triggers=[run_button.click, prompt.submit],
|