Spaces:
Paused
Paused
Update frontend/webui/ui.py
Browse files- frontend/webui/ui.py +22 -20
frontend/webui/ui.py
CHANGED
|
@@ -15,11 +15,8 @@ app_settings = get_settings()
|
|
| 15 |
model_list = ["model-a", "model-b", "model-c"]
|
| 16 |
|
| 17 |
def update_model_array(text_input):
|
| 18 |
-
# Split lines, remove empty strings, strip whitespace
|
| 19 |
updated = [line.strip() for line in text_input.split("\n") if line.strip()]
|
| 20 |
-
return gr.
|
| 21 |
-
|
| 22 |
-
|
| 23 |
|
| 24 |
|
| 25 |
def _get_footer_message() -> str:
|
|
@@ -46,22 +43,27 @@ def get_web_ui() -> gr.Blocks:
|
|
| 46 |
title="FastSD CPU",
|
| 47 |
) as fastsd_web_ui:
|
| 48 |
gr.HTML("<center><H1>FastSD CPU</H1></center>")
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
[
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 65 |
|
| 66 |
with gr.Tabs():
|
| 67 |
with gr.TabItem("Text to Image"):
|
|
|
|
| 15 |
model_list = ["model-a", "model-b", "model-c"]
|
| 16 |
|
| 17 |
def update_model_array(text_input):
|
|
|
|
| 18 |
updated = [line.strip() for line in text_input.split("\n") if line.strip()]
|
| 19 |
+
return gr.update(choices=updated, value=updated[0] if updated else None), "\n".join(updated)
|
|
|
|
|
|
|
| 20 |
|
| 21 |
|
| 22 |
def _get_footer_message() -> str:
|
|
|
|
| 43 |
title="FastSD CPU",
|
| 44 |
) as fastsd_web_ui:
|
| 45 |
gr.HTML("<center><H1>FastSD CPU</H1></center>")
|
| 46 |
+
gr.Column(scale=1):
|
| 47 |
+
current_mode = "LCM"
|
| 48 |
+
if app_settings.settings.lcm_diffusion_setting.use_openvino:
|
| 49 |
+
current_mode = "LCM-OpenVINO"
|
| 50 |
+
elif app_settings.settings.lcm_diffusion_setting.use_lcm_lora:
|
| 51 |
+
current_mode = "LCM-LoRA"
|
| 52 |
+
gr.Column(scale=1):
|
| 53 |
+
gr.Row():
|
| 54 |
+
model_text_area2 = gr.Textbox(value=" ", lines=10, label="Enter a new model")
|
| 55 |
+
update_button = gr.Button("Update Dropdown")
|
| 56 |
+
update_button.click( fn=update_model_array, inputs=model_text_area2, outputs=[model_dropdown, model_text_area], )
|
| 57 |
+
gr.Row():
|
| 58 |
+
model_dropdown = gr.Dropdown(choices=model_list, label="Select Model", value=model_list[0])
|
| 59 |
+
model_text_area = gr.Textbox(value="\n".join(model_list), lines=10, label="Edit Model List")
|
| 60 |
+
mode = gr.Radio(
|
| 61 |
+
["LCM", "LCM-LoRA", "LCM-OpenVINO"],
|
| 62 |
+
label="Mode",
|
| 63 |
+
info="Current working mode",
|
| 64 |
+
value=current_mode,
|
| 65 |
+
)
|
| 66 |
+
mode.change(change_mode, inputs=mode)
|
| 67 |
|
| 68 |
with gr.Tabs():
|
| 69 |
with gr.TabItem("Text to Image"):
|