Commit
·
3226311
1
Parent(s):
6ba4966
Update app.py
Browse files
app.py
CHANGED
@@ -4,10 +4,10 @@ from transformers import pipeline
|
|
4 |
def get_model():
|
5 |
return pipeline('text-generation', model='gpt-2')
|
6 |
|
7 |
-
def
|
8 |
model = get_model()
|
9 |
result = model(start_of_sentence, max_length=50, do_sample=True)[0]['generated_text']
|
10 |
return result
|
11 |
|
12 |
-
iface = gr.Interface(fn=
|
13 |
iface.launch()
|
|
|
4 |
def get_model():
|
5 |
return pipeline('text-generation', model='gpt-2')
|
6 |
|
7 |
+
def complete_text(start_of_sentence):
|
8 |
model = get_model()
|
9 |
result = model(start_of_sentence, max_length=50, do_sample=True)[0]['generated_text']
|
10 |
return result
|
11 |
|
12 |
+
iface = gr.Interface(fn=complete_text, inputs=gr.inputs.Textbox(lines=2, placeholder='Start of Sentence Here...'), outputs="text")
|
13 |
iface.launch()
|