Wootang01 commited on
Commit
548b35e
1 Parent(s): 1d9bfe0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -10
app.py CHANGED
@@ -1,14 +1,19 @@
1
  import gradio as gr
2
- from transformers import pipeline
3
 
4
- generator = pipeline('text-generation', model='EleutherAI/gpt-neo-1.3B')
5
- examples = [
6
- ["Once upon a time, Dr. Woo was teaching computer programming in a school."],
7
- ["Once upon a time, Dr. Woo was walking in a park. He "]
8
- ]
9
 
10
- def generate(text):
11
- result=generator(text, max_length=100, num_return_sequences=3)
12
- return result[0]['generated_text']
13
 
14
- gr.Interface(fn=generate, inputs=gr.inputs.Textbox(lines=5, label='input text'), outputs=gr.outputs.Textbox(label='output text'), title='My First Text Generator', examples=examples).launch()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  import gradio as gr
 
2
 
3
+ gr.Interface.load("EleutherAI/gpt-neo-1.3B").launch()
 
 
 
 
4
 
 
 
 
5
 
6
+ #import gradio as gr
7
+ #from transformers import pipeline
8
+
9
+ #generator = pipeline('text-generation', model='EleutherAI/gpt-neo-1.3B')
10
+ #examples = [
11
+ # ["Once upon a time, Dr. Woo was teaching computer programming in a school."],
12
+ # ["Once upon a time, Dr. Woo was walking in a park. He "]
13
+ #]
14
+
15
+ #def generate(text):
16
+ # result=generator(text, max_length=100, num_return_sequences=3)
17
+ # return result[0]['generated_text']
18
+
19
+ #gr.Interface(fn=generate, inputs=gr.inputs.Textbox(lines=5, label='input text'), outputs=gr.outputs.Textbox(label='output text'), title='My First Text Generator', examples=examples).launch()