Spaces:
Runtime error
Runtime error
Tonic commited on
modify interface
Browse files66 unmodified lines67686970717273747512 unmodified lines8889909192939495969798991001011026 unmodified lines1091101111121131141151161171181191201211221231246 unmodified lines1311321331341351361371381394 unmodified lines14414514614766 unmodified linesreturn assistant_responsedef update_advanced_settings(show_advanced):return {"visible": show_advanced}with gr.Blocks() as demo:with gr.Row():12 unmodified linessystem_prompt = gr.TextArea(label="πContext", placeholder="add context here...", lines=5)user_input = gr.TextArea(label="π€·π»ββοΈUser Input", placeholder="Hi there my name is Tonic!", lines=2)advanced_checkbox = gr.Checkbox(label="π§ͺ Advanced Settings", value=False)advanced_settings = gr.Column(visible=False)with advanced_settings:max_length = gr.Slider(label="πMax Length", minimum=12, maximum=1700, value=650, step=1)temperature = gr.Slider(label="π‘οΈTemperature", minimum=0.01, maximum=1.0, value=0.7, step=0.01)top_p = gr.Slider(label="βοΈTop-p (Nucleus Sampling)", minimum=0.1, maximum=1.0, value=0.9, step=0.01)use_pipeline = gr.Checkbox(label="Use Pipeline", value=False)use_tool = gr.Checkbox(label="Use Function Calling", value=False)tool_options = gr.Column(visible=False)with tool_options:tool_definition = gr.Code(label="Tool Definition (JSON)",value=customtool,6 unmodified lineswith gr.Column(scale=2):chatbot = gr.Chatbot(label="π€Mistral-NeMo-Minitron")def user(user_message, history):return "", history + [[user_message, None]]def bot(history, system_prompt, max_length, temperature, top_p, advanced_checkbox, use_pipeline, tool_definition):user_message = history[-1][0]do_sample = advanced_checkboxbot_message = generate_response(user_message, history, system_prompt, max_length, temperature, top_p, do_sample, use_pipeline, tool_definition)history[-1][1] = bot_messagereturn historygenerate_button.click(user,[user_input, chatbot],6 unmodified lines)advanced_checkbox.change(fn=update_advanced_settings,inputs=[advanced_checkbox],outputs=advanced_settings)use_tool.change(4 unmodified linesif __name__ == "__main__":demo.queue()demo.launch()66 unmodified lines67686970717273747576777879808112 unmodified lines9495969798991001011021031041051066 unmodified lines1131141151161171186 unmodified lines1251261271281291301311321334 unmodified lines13813914014166 unmodified linesreturn assistant_responsedef user(user_message, history):return "", history + [[user_message, None]]def bot(history, system_prompt, max_length, temperature, top_p, advanced_checkbox, use_pipeline, tool_definition):user_message = history[-1][0]do_sample = advanced_checkboxbot_message = generate_response(user_message, history, system_prompt, max_length, temperature, top_p, do_sample, use_pipeline, tool_definition)history[-1][1] = bot_messagereturn historywith gr.Blocks() as demo:with gr.Row():12 unmodified linessystem_prompt = gr.TextArea(label="πContext", placeholder="add context here...", lines=5)user_input = gr.TextArea(label="π€·π»ββοΈUser Input", placeholder="Hi there my name is Tonic!", lines=2)advanced_checkbox = gr.Checkbox(label="π§ͺ Advanced Settings", value=False)with gr.Column(visible=False) as advanced_settings:max_length = gr.Slider(label="πMax Length", minimum=12, maximum=1700, value=650, step=1)temperature = gr.Slider(label="π‘οΈTemperature", minimum=0.01, maximum=1.0, value=0.7, step=0.01)top_p = gr.Slider(label="βοΈTop-p (Nucleus Sampling)", minimum=0.1, maximum=1.0, value=0.9, step=0.01)use_pipeline = gr.Checkbox(label="Use Pipeline", value=False)use_tool = gr.Checkbox(label="Use Function Calling", value=False)with gr.Column(visible=False) as tool_options:tool_definition = gr.Code(label="Tool Definition (JSON)",value=customtool,6 unmodified lineswith gr.Column(scale=2):chatbot = gr.Chatbot(label="π€Mistral-NeMo-Minitron")generate_button.click(user,[user_input, chatbot],6 unmodified lines)advanced_checkbox.change(fn=lambda x: gr.update(visible=x),inputs=[advanced_checkbox],outputs=[advanced_settings])use_tool.change(4 unmodified linesif __name__ == "__main__":demo.queue()demo.launch()
app.py+13-19