Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -41,6 +41,8 @@ def respond(prompt, max_length, min_length, max_new_tokens, num_beams, temperatu
|
|
| 41 |
#response = correct_text(prompt, max_length, max_new_tokens, min_length, num_beams, temperature, top_p)
|
| 42 |
return prompt
|
| 43 |
|
|
|
|
|
|
|
| 44 |
|
| 45 |
# Create the Gradio interface
|
| 46 |
with gr.Blocks() as demo:
|
|
@@ -52,6 +54,17 @@ with gr.Blocks() as demo:
|
|
| 52 |
output_box = gr.Textbox()
|
| 53 |
submitBtn = gr.Button("Submit")
|
| 54 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 55 |
with gr.Accordion("Generation Parameters:", open=False):
|
| 56 |
max_length = gr.Slider(minimum=1, maximum=256, value=80, step=1, label="Max Length")
|
| 57 |
min_length = gr.Slider(minimum=1, maximum=256, value=0, step=1, label="Min Length")
|
|
@@ -60,9 +73,7 @@ with gr.Blocks() as demo:
|
|
| 60 |
temperature = gr.Slider(minimum=0.1, maximum=4.0, value=0.7, step=0.1, label="Temperature")
|
| 61 |
top_p = gr.Slider(minimum=0.1, maximum=1.0, value=0.95, step=0.05, label="Top-p (nucleus sampling)")
|
| 62 |
|
| 63 |
-
|
| 64 |
-
top_p_slider = gr.Slider(minimum=0.1, maximum=1.0, value=0.95, step=0.05, label="Top-p (nucleus sampling)", visible=True)
|
| 65 |
-
show_top_p.change(lambda show: gr.update(visible=show), show_top_p, top_p_slider)
|
| 66 |
|
| 67 |
submitBtn.click(correct_text, [prompt_box, max_length, min_length, max_tokens, num_beams, temperature, top_p], output_box)
|
| 68 |
|
|
|
|
| 41 |
#response = correct_text(prompt, max_length, max_new_tokens, min_length, num_beams, temperature, top_p)
|
| 42 |
return prompt
|
| 43 |
|
| 44 |
+
def update_prompt(text):
|
| 45 |
+
return text
|
| 46 |
|
| 47 |
# Create the Gradio interface
|
| 48 |
with gr.Blocks() as demo:
|
|
|
|
| 54 |
output_box = gr.Textbox()
|
| 55 |
submitBtn = gr.Button("Submit")
|
| 56 |
|
| 57 |
+
# Sample prompts
|
| 58 |
+
with gr.Row():
|
| 59 |
+
samp1 = gr.Button(value="we shood buy an car")
|
| 60 |
+
samp2 = gr.Button(value="she is more taller")
|
| 61 |
+
samp3 = gr.Button(value="John and i saw a sheep over their.")
|
| 62 |
+
|
| 63 |
+
samp1.click(update_prompt, samp1.value, prompt_box)
|
| 64 |
+
samp2.click(update_prompt, samp2.value, prompt_box)
|
| 65 |
+
samp3.click(update_prompt, samp3.value, prompt_box)
|
| 66 |
+
|
| 67 |
+
|
| 68 |
with gr.Accordion("Generation Parameters:", open=False):
|
| 69 |
max_length = gr.Slider(minimum=1, maximum=256, value=80, step=1, label="Max Length")
|
| 70 |
min_length = gr.Slider(minimum=1, maximum=256, value=0, step=1, label="Min Length")
|
|
|
|
| 73 |
temperature = gr.Slider(minimum=0.1, maximum=4.0, value=0.7, step=0.1, label="Temperature")
|
| 74 |
top_p = gr.Slider(minimum=0.1, maximum=1.0, value=0.95, step=0.05, label="Top-p (nucleus sampling)")
|
| 75 |
|
| 76 |
+
|
|
|
|
|
|
|
| 77 |
|
| 78 |
submitBtn.click(correct_text, [prompt_box, max_length, min_length, max_tokens, num_beams, temperature, top_p], output_box)
|
| 79 |
|