text-shuffler / app.py
heecheol.park
Add copy button to Shuffled Text output.
57cc534
Raw History Blame Contribute Delete
521 Bytes
import gradio as gr
import random
def shuffle_text(text):
lines = text.split('\n')
random.shuffle(lines)
return '\n'.join(lines)
def main():
iface = gr.Interface(
fn=shuffle_text,
inputs=gr.inputs.Textbox(lines=5, label="Input Text"),
outputs=gr.outputs.Textbox(label="Shuffled Text").style(show_copy_button=True),
title="Text Shuffler",
description="Enter text and get it shuffled line by line.",
)
iface.launch()
if __name__ == "__main__":
main()