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 demo: gr.Markdown("# 🦊 textgen") with gr.Group(): text = gr.TextArea(label="Text") length = gr.Number(label="Length", value=25) with gr.Row(): btn = gr.Button("Generate", variant="primary") clear = gr.Button("Clear") btn.click(generate, [text, length], [text]) clear.click(lambda: "", [], [text], show_api=False) if __name__ == "__main__": demo.launch(debug=True)