Exemple #1
0
                template = dataset_templates[template_name]

                code_height = 40
                input_fn_code = st.text_area('Input Function', height=code_height, value=template.input_fn)
                prompt_fn_code = st.text_area('Prompt Function', height=code_height, value=template.prompt_fn)
                output_fn_code = st.text_area('Output Function', height=code_height, value=template.output_fn)

                reference = st.text_area("Template Reference",
                                         help="Your name and/or paper reference.",
                                         value=template.reference)

                if st.form_submit_button("Save"):
                    template.input_fn = input_fn_code
                    template.prompt_fn = prompt_fn_code
                    template.output_fn = output_fn_code
                    template.reference = reference
                    save_data()

    #
    # Displays template output on current example if a template is selected
    # (in second column)
    #
    with col2:
        if template_name is not None:
            st.empty()
            st.subheader("Template Output")
            template = dataset_templates[template_name]
            prompt = template.apply(example)
            st.write(prompt[0])
            st.write(prompt[1])
            st.write(prompt[2])