File size: 521 Bytes
4d37dc4
 
 
 
 
 
 
 
 
 
 
 
 
2d77b0d
4d37dc4
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import gradio as gr

#api = gr.Interface.load("huggingface/EleutherAI/gpt-j-6B")
api = gr.Interface.load("models/bigscience/bloom")


def complete_with_gpt(text):
    # Use the last 50 characters of the text as context
    return text[:-50] + api(text[-50:])


with gr.Blocks() as demo:
    with gr.Row():
        textbox = gr.Textbox(placeholder="Type here and press enter...", lines=21)
        with gr.Column():
            btn = gr.Button("Generate")

    btn.click(complete_with_gpt, textbox, textbox)

demo.launch()