awacke1 commited on
Commit
ec45a48
1 Parent(s): 1993f84

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -0
app.py ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+
3
+ api = gr.Interface.load("huggingface/EleutherAI/gpt-j-6B")
4
+
5
+
6
+ def complete_with_gpt(text):
7
+ # Use the last 50 characters of the text as context
8
+ return text[:-50] + api(text[-50:])
9
+
10
+
11
+ with gr.Blocks() as demo:
12
+ textbox = gr.Textbox(placeholder="Type here and press enter...", lines=4)
13
+ btn = gr.Button("Generate")
14
+
15
+ btn.click(complete_with_gpt, textbox, textbox)
16
+
17
+ demo.launch()