Spaces:
Runtime error
Runtime error
Download app.py from pchuri/text-shuffler: direct link, hf CLI and curl.
- Browser
- Download file 521 Bytes
-
https://huggingface.co/spaces/pchuri/text-shuffler/resolve/main/app.py
- Command line
-
hf download hf://spaces/pchuri/text-shuffler/app.py
-
curl -L -o app.py https://huggingface.co/spaces/pchuri/text-shuffler/resolve/main/app.py
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() | |