gradio-app / gradio

Build and share delightful machine learning apps, all in Python. 🌟 Star to support our work!
http://www.gradio.app
Apache License 2.0
29.49k stars 2.19k forks source link

ChatInterface的additional_inputs参数怎么做才不被折叠? #8176

Closed Jacoo520 closed 2 weeks ago

Jacoo520 commented 2 weeks ago

Describe the bug

Have you searched existing issues? 🔎

Reproduction

部分代码:

model_list = ['llama2','llama3','gemma','llava','codellama','wizardlm2']
tab6 = gr.ChatInterface(fn = ollama_ai,
                        chatbot = gr.Chatbot(label = "流行大模型聊天"),
                        textbox= gr.Textbox(placeholder = "请输入你的问题",container=False),
                        additional_inputs = gr.Dropdown(choices=model_list,label='请选择模型'),
                        submit_btn = "发送",
                        clear_btn = "清除",
                        stop_btn = "停止",
                        undo_btn = "撤销",
                        retry_btn = "重试",
                        title = "AI聊天",
                        description=  "这是可以选择不同模型的聊天机器人,欢迎您的使用。")

Screenshot

1714475435976

Logs

No response

System Info

gradio: 4.24.0

Severity

I can work around it

abidlabs commented 2 weeks ago

Hi @Jacoo520 we require all issues to be submitted in English so that the team can understand and debug. Can you please translate the issue and we can reopen? Also can you please provide a standalone minimal code example that we can use to reproduce the issue above? See: https://stackoverflow.com/help/minimal-reproducible-example

Jacoo520 commented 2 weeks ago

嗨,我们要求所有问题都用英语提交,以便团队能够理解和调试。你能翻译一下这个问题,我们可以重新开放吗?另外,您能否提供一个独立的最小代码示例,我们可以用它来重现上述问题?请参见:https://stackoverflow.com/help/minimal-reproducible-example

I'm working on a chat interface to add a drop-down menu, but this drop-down menu is collapsed when it is displayed, I just want the drop-down menu to be displayed in the layout normally, not collapsed by default, and is it possible to put the additional drop-down menu components on top? or can this layout only be done using Blocks?

abidlabs commented 2 weeks ago

You can combine Blocks and ChatInterface to get this effect, e.g.

import gradio as gr

with gr.Blocks() as demo:
    dropdown = gr.Dropdown(["a", "b"])
    gr.ChatInterface(lambda x,y,z:x+z, additional_inputs=dropdown)

demo.launch()