import gradio as gr from gradio.inputs import Textbox io = gr.Interface.load("huggingface/EleutherAI/gpt-j-6B") def generate_text(c1, c2, area=None): if not(area.strip()): prompt = "{} is joining {}. By aquiring {}, a startup, {} will".format(c2, c1, c2, c1) else: prompt = "{} is joining {}. By aquiring {}, a {} startup, {} will".format(c2, c1, c2, area, c1) return io(prompt) examples = [ ["Hugging Face", "Gradio", "machine learning"], ["Microsoft", "GitHub", "hosting for version control"] ] gr.Interface(generate_text, [Textbox(label="Acquiring company"), Textbox(label="Startup"), Textbox(label="Type of startup (optional)")], "textbox", examples=examples, description="Acquisition Post Generator: provide the names of any 2 companies, and a state-of-the-art machine learning language model (GPT-J) will write about their acquisition.", theme="default").launch()