import gradio as gr def process(text): return text.replace('\n', '\\n') demo = gr.Interface(fn=process, inputs="text", outputs="text") demo.launch()