Spaces:
Runtime error
Runtime error
Matt
commited on
Commit
·
a06104a
1
Parent(s):
cb589d0
Move checkbox
Browse files
app.py
CHANGED
@@ -23,7 +23,7 @@ default_template = """{% for message in messages %}
|
|
23 |
|
24 |
conversations = [demo_conversation1, demo_conversation2]
|
25 |
|
26 |
-
def apply_chat_template(template,
|
27 |
if cleanup_whitespace:
|
28 |
template = "".join([line.strip() for line in template.split('\n')])
|
29 |
tokenizer.chat_template = template
|
@@ -39,9 +39,9 @@ iface = gr.Interface(
|
|
39 |
fn=apply_chat_template,
|
40 |
inputs=[
|
41 |
gr.TextArea(value=default_template, lines=10, max_lines=30, label="Chat Template"),
|
42 |
-
gr.Checkbox(value=True, label="Cleanup template whitespace"),
|
43 |
gr.TextArea(value=str(demo_conversation1), lines=5, label="Conversation 1"),
|
44 |
gr.TextArea(value=str(demo_conversation2), lines=5, label="Conversation 2")
|
|
|
45 |
],
|
46 |
outputs=[gr.TextArea(label=output_name) for output_name in output_names])
|
47 |
iface.launch()
|
|
|
23 |
|
24 |
conversations = [demo_conversation1, demo_conversation2]
|
25 |
|
26 |
+
def apply_chat_template(template, test_conversation1, test_conversation2, cleanup_whitespace):
|
27 |
if cleanup_whitespace:
|
28 |
template = "".join([line.strip() for line in template.split('\n')])
|
29 |
tokenizer.chat_template = template
|
|
|
39 |
fn=apply_chat_template,
|
40 |
inputs=[
|
41 |
gr.TextArea(value=default_template, lines=10, max_lines=30, label="Chat Template"),
|
|
|
42 |
gr.TextArea(value=str(demo_conversation1), lines=5, label="Conversation 1"),
|
43 |
gr.TextArea(value=str(demo_conversation2), lines=5, label="Conversation 2")
|
44 |
+
gr.Checkbox(value=True, label="Cleanup template whitespace"),
|
45 |
],
|
46 |
outputs=[gr.TextArea(label=output_name) for output_name in output_names])
|
47 |
iface.launch()
|