Spaces:
Sleeping
Sleeping
| import subprocess | |
| subprocess.run("pip install ./textgen.zip", shell=True) | |
| import gradio as gr | |
| from textgen import load | |
| textgen = load() | |
| def generate(text, length=50): | |
| return textgen.generate(text, length=length) | |
| with gr.Blocks() as app: | |
| gr.Markdown("# 🦊 textgen") | |
| with gr.Column(variant="panel"): | |
| with gr.Row(): | |
| text = gr.TextArea(label="Text") | |
| with gr.Row(): | |
| length = gr.Number(label="Length", value=25) | |
| with gr.Row(variant="panel"): | |
| btn = gr.Button("Generate", variant="primary") | |
| clear = gr.Button("Clear") | |
| btn.click(generate, [text, length], [text]) | |
| clear.click(lambda: "", None, [text], queue=False) | |
| if __name__ == "__main__": | |
| app.queue().launch(debug=True, ssr_mode=False) |