Spaces:
Sleeping
Sleeping
Update Gradio_UI.py
Browse files258 unmodified lines2592602612622632641 unmodified line266267268269270271258 unmodified lines),"",)def launch(self, **kwargs):import gradio as gr1 unmodified linewith gr.Blocks(fill_height=True) as demo:stored_messages = gr.State([])file_uploads_log = gr.State([])chatbot = gr.Chatbot(label="Agent",type="messages",258 unmodified lines2592602612622632642652662672682692702712722732742752762772782792802812822832842852861 unmodified line288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331258 unmodified lines),"",)def update_model(self, model_id):"""Update the agent's model with a new model ID"""import gradio as grtry:from smolagents import HfApiModel# Create a new model with the provided IDnew_model = HfApiModel(max_tokens=2096,temperature=0.5,model_id=model_id,custom_role_conversions=None,)# Update the agent's modelself.agent.model = new_modelreturn gr.Textbox(f"Model updated to: {model_id}", visible=True)except Exception as e:return gr.Textbox(f"Error updating model: {str(e)}", visible=True)def launch(self, **kwargs):import gradio as gr1 unmodified linewith gr.Blocks(fill_height=True) as demo:stored_messages = gr.State([])file_uploads_log = gr.State([])# Add model selection UI elementswith gr.Row():with gr.Column(scale=3):model_input = gr.Textbox(label="Enter Model ID",placeholder="e.g., Qwen/Qwen2.5-Coder-32B-Instruct",value="Qwen/Qwen2.5-Coder-32B-Instruct")with gr.Column(scale=1):update_button = gr.Button("Update Model")model_status = gr.Textbox(label="Model Status", interactive=False, visible=False)update_button.click(self.update_model,[model_input],[model_status],)# Dropdown with preset model optionsmodel_dropdown = gr.Dropdown(choices=["Qwen/Qwen2.5-Coder-32B-Instruct","https://pflgm2locj2t89co.us-east-1.aws.endpoints.huggingface.cloud","CohereLabs/c4ai-command-a-03-2025"],label="Preset Models",value="Qwen/Qwen2.5-Coder-32B-Instruct")# Update the textbox when a preset is selectedmodel_dropdown.change(lambda x: x,[model_dropdown],[model_input])chatbot = gr.Chatbot(label="Agent",type="messages",
Gradio_UI.py+60