|
import gradio as gr |
|
|
|
def greet(prompt, temperature, max_lenth, top_p): |
|
return f"Hello, world! {temperature}" |
|
|
|
demo = gr.Interface( |
|
fn=greet, |
|
inputs=[gr.Textbox(placeholder = "Write a tagline for an ice cream shop.", label="prompt", lines=5), |
|
gr.Slider(value=1, minimum=0, maximum=2, label='temperature', |
|
info='''Temperature controls the randomness of the text generation. |
|
1.0 makes the model more likely to generate diverse and sometimes more unexpected outputs. |
|
0.0 makes the model's responses more deterministic and predictable.'''), |
|
gr.Slider(value=16, minimum=1, maximum=256, step=1, label='max_lenth', |
|
info='''Maximum number of tokens that the model will generate in the output.'''), |
|
gr.Slider(value=1, minimum=0, maximum=1, label='top_p', |
|
info='''Top-p controls the model's focus during text generation. |
|
It allows only the most probable tokens to be considered for generation, where the cumulative probability of these tokens must exceed this value.''') |
|
], |
|
outputs=[gr.Textbox(label='Output texts')], |
|
) |
|
|
|
demo.launch() |