File size: 903 Bytes
7681358
 
 
9342fd8
7681358
 
3cce62f
7681358
 
 
 
 
 
 
 
 
 
9342fd8
5b1d56f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import gradio as gr
from aitextgen import aitextgen

ai = aitextgen(model="EleutherAI/gpt-neo-2.7B")

def ai_text(inp):
  generated_text = ai.generate_one(max_length=100, prompt = inp, no_repeat_ngram_size=3)
  print(type(generated_text))
  return generated_text
  
examples = [
  ["Artificial intelligence will"],
  ["Probably everyone has heard of the 20 year-old singer named Zoe Kwan."],
  ["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."]
   ] 
  
output_text = gr.outputs.Textbox()
gr.Interface(ai_text,"textbox", output_text, title="Text Generator GPT-NEO-2.7B",
             description="Copy or type text. Submit and the machine will generate text.", examples=examples).launch(share=False)