import gradio as gr with gr.Blocks() as demo: textbox = gr.Textbox(value=['Connected Trip', 'Booking.com', 'Trip Planner']) textbox_2 = gr.Textbox() button = gr.Button() @button.click(inputs=[textbox], outputs=[textbox_2]) def fn_1(textbox): def is_i18n_data(value): return isinstance(value, dict) and 'text' in value and 'locale' in value if is_i18n_data(textbox): text = textbox['text'] else: text = str(textbox) char_count = {} for char in text: if char in char_count: char_count[char] += 1 else: char_count[char] = 1 sorted_char_count = sorted(char_count.items(), key=lambda item: item[1], reverse=True) report = "Character Count Report:\n" for char, count in sorted_char_count: report += f"Character: '{char}' - Count: {count}\n" return report.strip() demo.launch()