awacke1 commited on
Commit
4d37dc4
Β·
1 Parent(s): e537f7d

Create app.py

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