Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,9 +1,8 @@
|
|
1 |
import gradio as gr
|
2 |
from transformers import pipeline
|
3 |
|
4 |
-
|
5 |
-
|
6 |
-
def generate(text,max_length,temperature,num_beams,top_k,top_p,repetition_penalty):
|
7 |
result = generator(text, num_return_sequences=3,
|
8 |
max_length=max_length,
|
9 |
temperature=temperature,
|
@@ -18,6 +17,7 @@ demo = gr.Interface(
|
|
18 |
fn=generate,
|
19 |
inputs=[
|
20 |
gr.Textbox(lines=5, label="Input Text"),
|
|
|
21 |
gr.Slider(value=50,label="Max Length",minimum=1,maximum=200),
|
22 |
gr.Slider(value=1.0,label="Temperature",minimum=0.0,maximum=1.0,step=0.05),
|
23 |
gr.Slider(value=4,label="Num Beams",minimum=2,maximum=6,step=1),
|
|
|
1 |
import gradio as gr
|
2 |
from transformers import pipeline
|
3 |
|
4 |
+
def generate(text,the_model,max_length,temperature,num_beams,top_k,top_p,repetition_penalty):
|
5 |
+
generator = pipeline('text-generation', model=the_model)
|
|
|
6 |
result = generator(text, num_return_sequences=3,
|
7 |
max_length=max_length,
|
8 |
temperature=temperature,
|
|
|
17 |
fn=generate,
|
18 |
inputs=[
|
19 |
gr.Textbox(lines=5, label="Input Text"),
|
20 |
+
gr.Dropdown(choices=['gpt2','gpt2-medium','gpt2-large','gpt2-xl'],value = 'gpt2',label="Choose model"),
|
21 |
gr.Slider(value=50,label="Max Length",minimum=1,maximum=200),
|
22 |
gr.Slider(value=1.0,label="Temperature",minimum=0.0,maximum=1.0,step=0.05),
|
23 |
gr.Slider(value=4,label="Num Beams",minimum=2,maximum=6,step=1),
|