Wootang01/text_generator_three
1
1#level 5 text generator2import gradio as gr3 4api = gr.Interface.load("huggingface/EleutherAI/gpt-neo-2.7B")5 6 7def complete_with_gpt(text):8 # Use the last 50 characters of the text as context9 return text[:-50] + api(text[-50:])10 11 12with gr.Blocks() as demo:13 with gr.Row():14 textbox = gr.Textbox(placeholder="Type here and press enter...", lines=8)15 with gr.Column():16 btn = gr.Button("Generate")17 18 btn.click(complete_with_gpt, textbox, textbox)19 20demo.launch()