Spaces:
Running
on
Zero
Running
on
Zero
fix: generate
Browse files
app.py
CHANGED
@@ -245,25 +245,20 @@ with gr.Blocks(
|
|
245 |
)
|
246 |
|
247 |
# Event handlers for button actions to process and clear text
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
248 |
generate_btn.click(
|
249 |
-
fn=
|
250 |
-
|
251 |
-
temp,
|
252 |
-
max_t,
|
253 |
-
top_k,
|
254 |
-
rep_pen,
|
255 |
-
top_p,
|
256 |
-
STYLE_PROMPTS[style]
|
257 |
-
),
|
258 |
-
inputs=[
|
259 |
-
input_text,
|
260 |
-
gr.Number(value=0.3, visible=False), # temperature
|
261 |
-
gr.Number(value=1024, visible=False), # max_tokens
|
262 |
-
gr.Number(value=40, visible=False), # top_k
|
263 |
-
gr.Number(value=1.1, visible=False), # repetition_penalty
|
264 |
-
gr.Number(value=0.95, visible=False), # top_p
|
265 |
-
style_dropdown,
|
266 |
-
],
|
267 |
outputs=output_text,
|
268 |
)
|
269 |
|
|
|
245 |
)
|
246 |
|
247 |
# Event handlers for button actions to process and clear text
|
248 |
+
def format_with_style(text, style):
|
249 |
+
return generate(
|
250 |
+
text,
|
251 |
+
temperature=0.3,
|
252 |
+
max_tokens=1024,
|
253 |
+
top_k=40,
|
254 |
+
repetition_penalty=1.1,
|
255 |
+
top_p=0.95,
|
256 |
+
prompt_style=STYLE_PROMPTS[style]
|
257 |
+
)
|
258 |
+
|
259 |
generate_btn.click(
|
260 |
+
fn=format_with_style,
|
261 |
+
inputs=[input_text, style_dropdown],
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
262 |
outputs=output_text,
|
263 |
)
|
264 |
|