textgen / app.py
cutiee82's picture
Update app.py
1cda688 verified
raw
history blame
774 Bytes
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)