Spaces:
Sleeping
Sleeping
import subprocess | |
subprocess.run(["pip", "install", "./textgen.zip"]) | |
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], show_api=False) | |
if __name__ == "__main__": | |
app.queue().launch(debug=True, ssr_mode=False) |