Spaces:
Running
Running
sidebar collapse when enter and generate
Browse files
app.py
CHANGED
|
@@ -5122,8 +5122,8 @@ with gr.Blocks(
|
|
| 5122 |
)
|
| 5123 |
|
| 5124 |
def begin_generation_ui():
|
| 5125 |
-
#
|
| 5126 |
-
return [gr.update(), gr.update(visible=False)]
|
| 5127 |
|
| 5128 |
def end_generation_ui():
|
| 5129 |
# Keep sidebar as is; hide the status
|
|
@@ -5152,6 +5152,30 @@ with gr.Blocks(
|
|
| 5152 |
outputs=[space_name_input, deploy_btn]
|
| 5153 |
)
|
| 5154 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5155 |
# --- Chat-based sidebar controller logic ---
|
| 5156 |
def _find_model_by_name(name: str):
|
| 5157 |
for m in AVAILABLE_MODELS:
|
|
|
|
| 5122 |
)
|
| 5123 |
|
| 5124 |
def begin_generation_ui():
|
| 5125 |
+
# Collapse the sidebar when generation starts; keep status hidden
|
| 5126 |
+
return [gr.update(open=False), gr.update(visible=False)]
|
| 5127 |
|
| 5128 |
def end_generation_ui():
|
| 5129 |
# Keep sidebar as is; hide the status
|
|
|
|
| 5152 |
outputs=[space_name_input, deploy_btn]
|
| 5153 |
)
|
| 5154 |
|
| 5155 |
+
# Pressing Enter in the main input should trigger generation and collapse the sidebar
|
| 5156 |
+
input.submit(
|
| 5157 |
+
begin_generation_ui,
|
| 5158 |
+
inputs=None,
|
| 5159 |
+
outputs=[sidebar, generating_status],
|
| 5160 |
+
show_progress="hidden",
|
| 5161 |
+
).then(
|
| 5162 |
+
generation_code,
|
| 5163 |
+
inputs=[input, image_input, generation_image_input, file_input, website_url_input, setting, history, current_model, search_toggle, language_dropdown, provider_state, image_generation_toggle, image_to_image_toggle, image_to_image_prompt, text_to_image_prompt, image_to_video_toggle, image_to_video_prompt, text_to_video_toggle, text_to_video_prompt],
|
| 5164 |
+
outputs=[code_output, history, sandbox, history_output]
|
| 5165 |
+
).then(
|
| 5166 |
+
end_generation_ui,
|
| 5167 |
+
inputs=None,
|
| 5168 |
+
outputs=[sidebar, generating_status]
|
| 5169 |
+
).then(
|
| 5170 |
+
show_deploy_components,
|
| 5171 |
+
None,
|
| 5172 |
+
[space_name_input, sdk_dropdown, deploy_btn]
|
| 5173 |
+
).then(
|
| 5174 |
+
preserve_space_info_for_followup,
|
| 5175 |
+
inputs=[history],
|
| 5176 |
+
outputs=[space_name_input, deploy_btn]
|
| 5177 |
+
)
|
| 5178 |
+
|
| 5179 |
# --- Chat-based sidebar controller logic ---
|
| 5180 |
def _find_model_by_name(name: str):
|
| 5181 |
for m in AVAILABLE_MODELS:
|