Spaces:
Sleeping
Sleeping
Amitontheweb
commited on
Commit
•
78b413a
1
Parent(s):
709b944
Update app.py
Browse files
app.py
CHANGED
@@ -302,6 +302,24 @@ with gr.Blocks() as demo:
|
|
302 |
strategy_selected = gr.Radio (["Sampling", "Beam Search", "Diversity Beam Search","Contrastive"], label="Search strategy", value = "Sampling", interactive=True)
|
303 |
|
304 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
305 |
with gr.Column (scale=0, min_width=250) as Beam_Params:
|
306 |
n_steps = gr.Slider(
|
307 |
label="Number of steps/tokens", minimum=1, maximum=100, step=1, value=20
|
@@ -357,15 +375,6 @@ with gr.Blocks() as demo:
|
|
357 |
label="Repetition penalty", minimum=0, maximum=3, step=1, value=float(0), info="Prior context based penalty for unique text"
|
358 |
)
|
359 |
|
360 |
-
with gr.Column(scale=2):
|
361 |
-
|
362 |
-
text = gr.Textbox(
|
363 |
-
label="Prompt",
|
364 |
-
autoscroll=True,
|
365 |
-
value="It's a rainy day today"
|
366 |
-
)
|
367 |
-
|
368 |
-
out_markdown = gr.Textbox(label="Output", autoscroll=True)
|
369 |
|
370 |
|
371 |
#----------ON SELECTING/CHANGING: RETURN SEEQUENCES/NO OF BEAMS/BEAM GROUPS/TEMPERATURE--------
|
@@ -393,19 +402,12 @@ with gr.Blocks() as demo:
|
|
393 |
|
394 |
#-------------GENERATE BUTTON-------------------
|
395 |
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
fn = generate,
|
403 |
-
inputs=[text, n_steps, n_beams, beam_groups, diversity_penalty, length_penalty, num_return_sequences, temperature, no_repeat_ngram_size, repetition_penalty, early_stopping, beam_temperature, top_p, top_k,penalty_alpha,top_p_box,top_k_box,strategy_selected,model_selected],
|
404 |
-
outputs=[out_markdown]
|
405 |
-
)
|
406 |
-
with gr.Column (scale=0, min_width=200):
|
407 |
-
cleared = gr.Button ("Clear")
|
408 |
-
cleared.click (fn=clear, inputs=[], outputs=[out_markdown])
|
409 |
|
410 |
with gr.Row():
|
411 |
|
|
|
302 |
strategy_selected = gr.Radio (["Sampling", "Beam Search", "Diversity Beam Search","Contrastive"], label="Search strategy", value = "Sampling", interactive=True)
|
303 |
|
304 |
|
305 |
+
with gr.Column(scale=1):
|
306 |
+
|
307 |
+
text = gr.Textbox(
|
308 |
+
label="Prompt",
|
309 |
+
autoscroll=True,
|
310 |
+
value="It's a rainy day today"
|
311 |
+
)
|
312 |
+
|
313 |
+
out_markdown = gr.Textbox(label="Output", autoscroll=True)
|
314 |
+
|
315 |
+
button = gr.Button("Generate")
|
316 |
+
|
317 |
+
cleared = gr.Button ("Clear")
|
318 |
+
cleared.click (fn=clear, inputs=[], outputs=[out_markdown])
|
319 |
+
|
320 |
+
|
321 |
+
|
322 |
+
|
323 |
with gr.Column (scale=0, min_width=250) as Beam_Params:
|
324 |
n_steps = gr.Slider(
|
325 |
label="Number of steps/tokens", minimum=1, maximum=100, step=1, value=20
|
|
|
375 |
label="Repetition penalty", minimum=0, maximum=3, step=1, value=float(0), info="Prior context based penalty for unique text"
|
376 |
)
|
377 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
378 |
|
379 |
|
380 |
#----------ON SELECTING/CHANGING: RETURN SEEQUENCES/NO OF BEAMS/BEAM GROUPS/TEMPERATURE--------
|
|
|
402 |
|
403 |
#-------------GENERATE BUTTON-------------------
|
404 |
|
405 |
+
button.click(
|
406 |
+
fn = generate,
|
407 |
+
inputs=[text, n_steps, n_beams, beam_groups, diversity_penalty, length_penalty, num_return_sequences, temperature, no_repeat_ngram_size, repetition_penalty, early_stopping, beam_temperature, top_p, top_k,penalty_alpha,top_p_box,top_k_box,strategy_selected,model_selected],
|
408 |
+
outputs=[out_markdown]
|
409 |
+
)
|
410 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
411 |
|
412 |
with gr.Row():
|
413 |
|