import gradio as gr K = 5 def create_demo(callback): with gr.Blocks() as demo: with gr.Row(): with gr.Column(): fn = gr.Textbox(label="Company name", placeholder="Enter company name here...") with gr.Row(): with gr.Column(): outs = [gr.Text(show_label=False) for _ in range(K)] outs[0].label = "Similar company names" outs[0].show_label = True btn = gr.Button("Find similar companies", variant="primary") btn.click(callback, inputs=fn, outputs=outs) return demo class Callback: def __init__(self): pass def __call__(self, input_name): res = ["These are completely different companies."] * K return res def main(): callback = Callback() demo = create_demo(callback) demo.launch() if __name__ == "__main__": main()