EricLam commited on
Commit
907a6eb
1 Parent(s): 9a89ea7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -6
app.py CHANGED
@@ -1,10 +1,21 @@
1
- import gradio as gr
2
 
3
- gr.Interface.load("huggingface/EleutherAI/gpt-j-6B",title="can i help u",description="Input your text,submit and the machine will output test").launch()
4
  import gradio as gr
5
- from gradio import inputs
6
- from gradio.inputs import Textbox
7
- from gradio import outputs
8
- from transformers import pipeline
 
 
 
 
 
 
 
 
 
 
 
 
9
 
10
 
 
 
1
 
2
+
3
  import gradio as gr
4
+
5
+ api = gr.Interface.load("huggingface/EleutherAI/gpt-j-6B")
6
+
7
+ def complete_with_gpt(text):
8
+ return text[:-50] + api(text[-50:])
9
+
10
+ with gr.Blocks() as demo:
11
+ with gr.Row():
12
+ textbox = gr.Textbox(placeholder="Type here and press enter...", lines=8)
13
+ with gr.Column():
14
+ btn = gr.Button("Generate")
15
+
16
+ btn.click(complete_with_gpt, textbox, textbox)
17
+
18
+ demo.launch()
19
+
20
 
21