Wootang01 commited on
Commit
7681358
·
1 Parent(s): 1619461

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +19 -0
app.py ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from aitextgen import aitextgen
3
+
4
+ ai = aitextgen(model="EleutherAI/gpt-j-6B")
5
+
6
+ def ai_text(inp):
7
+ generated_text = ai.generate_one(max_length=50, prompt = inp, no_repeat_ngram_size=3)
8
+ print(type(generated_text))
9
+ return generated_text
10
+
11
+ examples = [
12
+ ["Artificial intelligence will"],
13
+ ["Probably everyone has heard of the 20 year-old singer named Zoe Kwan."],
14
+ ["Mars, Joyce and Venus had their first day at Blazing Inventions Academy in North Point, Hong Kong. The following day, while Mars, Joyce and Venus are eating breakfast in the Academy’s hall, a green gas spreads from North Point throughout the world."]
15
+ ]
16
+
17
+ output_text = gr.outputs.Textbox()
18
+ gr.Interface(ai_text,"textbox", output_text, title="Text Generator GPT-J-6B",
19
+ description="Copy or type text. Submit and the machine will generate text.", examples=examples).launch()