Spaces:
Runtime error
Runtime error
update readme.md
Browse files
app.py
CHANGED
@@ -103,9 +103,9 @@ if st.session_state['tokenizer_json'] is not None:
|
|
103 |
|
104 |
with prompt_template_col:
|
105 |
list_of_templates = get_existing_templates()
|
106 |
-
selected_template = st.selectbox("Choose Existing Template or Leave Blank.",
|
107 |
options=list_of_templates,
|
108 |
-
index=0, placeholder="Choose
|
109 |
# add_generation_prompt_checkbox = st.checkbox("add_generation_prompt")
|
110 |
generate_prompt_example_button = st.button("Generate Prompt", key="generate_prompt_example_button")
|
111 |
|
@@ -119,6 +119,12 @@ if st.session_state['tokenizer_json'] is not None:
|
|
119 |
jinja_lines = f.readlines()
|
120 |
st.session_state['input_jinja_template'] = "".join(jinja_lines)
|
121 |
|
|
|
|
|
|
|
|
|
|
|
|
|
122 |
st.session_state['input_jinja_template'] = st.text_area(
|
123 |
"Jinja Chat Template", value=st.session_state['input_jinja_template'],
|
124 |
height=500, placeholder=None, disabled=False, label_visibility="visible")
|
|
|
103 |
|
104 |
with prompt_template_col:
|
105 |
list_of_templates = get_existing_templates()
|
106 |
+
selected_template = st.selectbox("Choose Existing Template or Leave Blank. (If template is None, it will check current tokenizer's `chat_template` and `default_chat_template` fields)",
|
107 |
options=list_of_templates,
|
108 |
+
index=0, placeholder="Choose a template (If template is None, it will check current tokenizer `chat_template` and `default_chat_template` fields)", disabled=False, label_visibility="visible")
|
109 |
# add_generation_prompt_checkbox = st.checkbox("add_generation_prompt")
|
110 |
generate_prompt_example_button = st.button("Generate Prompt", key="generate_prompt_example_button")
|
111 |
|
|
|
119 |
jinja_lines = f.readlines()
|
120 |
st.session_state['input_jinja_template'] = "".join(jinja_lines)
|
121 |
|
122 |
+
if selected_template is None:
|
123 |
+
st.session_state['input_jinja_template'] = st.session_state['tokenizer'].chat_template
|
124 |
+
if st.session_state['input_jinja_template'] is None:
|
125 |
+
st.session_state['input_jinja_template'] = st.session_state['tokenizer'].default_chat_template
|
126 |
+
|
127 |
+
|
128 |
st.session_state['input_jinja_template'] = st.text_area(
|
129 |
"Jinja Chat Template", value=st.session_state['input_jinja_template'],
|
130 |
height=500, placeholder=None, disabled=False, label_visibility="visible")
|