adding generator
Browse files
app.py
CHANGED
@@ -3,5 +3,21 @@ import gradio as gr
|
|
3 |
def greet(name):
|
4 |
return "Hello " + name + "!!"
|
5 |
|
6 |
-
|
7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
def greet(name):
|
4 |
return "Hello " + name + "!!"
|
5 |
|
6 |
+
def plex(input_text):
|
7 |
+
mnputs = tokenizer(input_text, return_tensors='pt')
|
8 |
+
prediction = model.generate(mnputs['input_ids'], min_length=20, max_length=150, num_return_sequences=1)
|
9 |
+
lines = tokenizer.decode(prediction[0]).splitlines()
|
10 |
+
return lines[0]
|
11 |
+
|
12 |
+
iface=gr.Interface(
|
13 |
+
fn=plex,
|
14 |
+
inputs=gr.Textbox(label="Prompt", value="Once upon a"),
|
15 |
+
outputs=gr.Textbox(label="Generated_Text"),
|
16 |
+
title="GPT-Neo-125M",
|
17 |
+
description="Prompt"
|
18 |
+
)
|
19 |
+
iface.queue(max_size=1,api_open=False)
|
20 |
+
iface.launch(max_threads=1)
|
21 |
+
|
22 |
+
# iface = gr.Interface(fn=greet, inputs="text", outputs="text")
|
23 |
+
# iface.launch()
|