refactor(frontend): 重构模型选择界面的变量命名
- 将模型选择的 Dropdown 组件从 dropdown 重命名为 model_select_dropdown,提高代码可读性 - 更新 load_button 和 refresh_button 的输出目标,以适应新的变量名
This commit is contained in:
parent
1b3f546669
commit
2e552c186d
@ -18,7 +18,7 @@ def model_manage_page():
|
|||||||
output_text = gr.Textbox(label="当前状态", interactive=False)
|
output_text = gr.Textbox(label="当前状态", interactive=False)
|
||||||
with gr.Row():
|
with gr.Row():
|
||||||
with gr.Column(scale=3):
|
with gr.Column(scale=3):
|
||||||
dropdown = gr.Dropdown(choices=model_folders, label="选择模型", interactive=True) # 将子文件夹列表添加到Dropdown组件中,并设置为可选
|
model_select_dropdown = gr.Dropdown(choices=model_folders, label="选择模型", interactive=True) # 将子文件夹列表添加到Dropdown组件中,并设置为可选
|
||||||
max_seq_length_input = gr.Number(label="最大序列长度", value=4096, precision=0)
|
max_seq_length_input = gr.Number(label="最大序列长度", value=4096, precision=0)
|
||||||
load_in_4bit_input = gr.Checkbox(label="使用4位量化", value=True)
|
load_in_4bit_input = gr.Checkbox(label="使用4位量化", value=True)
|
||||||
with gr.Column(scale=1):
|
with gr.Column(scale=1):
|
||||||
@ -49,7 +49,7 @@ def model_manage_page():
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
return f"加载模型时出错: {str(e)}"
|
return f"加载模型时出错: {str(e)}"
|
||||||
|
|
||||||
load_button.click(fn=load_model, inputs=[dropdown, max_seq_length_input, load_in_4bit_input], outputs=output_text)
|
load_button.click(fn=load_model, inputs=[model_select_dropdown, max_seq_length_input, load_in_4bit_input], outputs=output_text)
|
||||||
|
|
||||||
def unload_model():
|
def unload_model():
|
||||||
try:
|
try:
|
||||||
@ -98,7 +98,7 @@ def model_manage_page():
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
return f"刷新模型列表时出错: {str(e)}"
|
return f"刷新模型列表时出错: {str(e)}"
|
||||||
|
|
||||||
refresh_button.click(fn=refresh_model_list, inputs=None, outputs=dropdown)
|
refresh_button.click(fn=refresh_model_list, inputs=None, outputs=model_select_dropdown)
|
||||||
|
|
||||||
return demo
|
return demo
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user