"""Reproduction for https://github.com/gradio-app/gradio/issues/8771. Open "Additional Inputs", then close it again, and watch the chatbot. The accordion is deliberately tall so that opening it overflows the frame even in a large window. If it still fits, the frame never grows and there is nothing for the fix to do; make the browser window shorter in that case. Before the fix it stays tall and pushes the message box off screen; after the fix the layout returns to where it started. """ import gradio as gr PLACEHOLDER = """

Chat

Open "Additional Inputs" below, then close it again.

""" def respond(message, history, model, system_message, max_tokens, temperature, top_p, top_k, repetition_penalty, beams, length_penalty, seed): return f"{model} | {system_message} | {max_tokens} | {message}" demo = gr.ChatInterface( respond, additional_inputs=[ gr.Dropdown( ["Meta-Llama-3-70B-Instruct-Q3_K_M.gguf", "gemma-2-27b-it-Q8_0.gguf"], value="gemma-2-27b-it-Q8_0.gguf", label="Model", ), gr.Textbox( value="You are a helpful assistant.", label="System message", lines=40, ), gr.Slider(minimum=1, maximum=4096, value=2048, step=1, label="Max tokens"), gr.Slider(minimum=0.1, maximum=4.0, value=0.7, step=0.1, label="Temperature"), gr.Slider(minimum=0.1, maximum=1.0, value=0.95, step=0.05, label="Top-p"), gr.Slider(minimum=0, maximum=100, value=40, step=1, label="Top-k"), gr.Slider( minimum=0.0, maximum=2.0, value=1.1, step=0.1, label="Repetition penalty" ), gr.Slider(minimum=0, maximum=10, value=1, step=1, label="Beams"), gr.Slider(minimum=0.0, maximum=2.0, value=0.0, step=0.1, label="Length penalty"), gr.Slider(minimum=0, maximum=8192, value=0, step=1, label="Seed"), ], chatbot=gr.Chatbot(scale=1, placeholder=PLACEHOLDER), ) if __name__ == "__main__": demo.launch(ssr_mode=False)