Spaces:
Sleeping
Sleeping
Default and few-shot parameters
Browse files
app.py
CHANGED
@@ -66,10 +66,15 @@ def pass_to_input(generated_gl):
|
|
66 |
gr.update(value=generated_gl),
|
67 |
None,
|
68 |
)
|
|
|
|
|
|
|
|
|
|
|
69 |
|
70 |
-
def
|
71 |
return (
|
72 |
-
gr.update(value=
|
73 |
gr.update(value=1) # repetition_penalty
|
74 |
)
|
75 |
|
@@ -120,16 +125,17 @@ def gradio_app():
|
|
120 |
gr.Examples(
|
121 |
label = "Short prompts",
|
122 |
examples = short_prompts_examples,
|
123 |
-
inputs = [text_gl
|
124 |
-
outputs =
|
125 |
-
fn =
|
|
|
126 |
)
|
127 |
gr.Examples(
|
128 |
label = "Few-shot prompts",
|
129 |
examples = few_shot_prompts_examples,
|
130 |
inputs = [text_gl],
|
131 |
outputs = [max_length, repetition_penalty],
|
132 |
-
fn =
|
133 |
run_on_click = True
|
134 |
)
|
135 |
|
|
|
66 |
gr.update(value=generated_gl),
|
67 |
None,
|
68 |
)
|
69 |
+
def parameters_default(text):
|
70 |
+
return (
|
71 |
+
gr.update(value=30), # max_length
|
72 |
+
gr.update(value=1.3) # repetition_penalty
|
73 |
+
)
|
74 |
|
75 |
+
def parameters_fewshot_prompt(text):
|
76 |
return (
|
77 |
+
gr.update(value=15), # max_length
|
78 |
gr.update(value=1) # repetition_penalty
|
79 |
)
|
80 |
|
|
|
125 |
gr.Examples(
|
126 |
label = "Short prompts",
|
127 |
examples = short_prompts_examples,
|
128 |
+
inputs = [text_gl],
|
129 |
+
outputs = [max_length, repetition_penalty],
|
130 |
+
fn = parameters_default,
|
131 |
+
run_on_click = True
|
132 |
)
|
133 |
gr.Examples(
|
134 |
label = "Few-shot prompts",
|
135 |
examples = few_shot_prompts_examples,
|
136 |
inputs = [text_gl],
|
137 |
outputs = [max_length, repetition_penalty],
|
138 |
+
fn = parameters_fewshot_prompt,
|
139 |
run_on_click = True
|
140 |
)
|
141 |
|