Ejemplo n.º 1
0
def create_html_tree(template: Airium, curr_beg: str, ele,
                     all_existing_files: List[str]) -> None:
    """
    Method used to create all of HTML tree chooser's branches and leaves.
    """
    if len(ele) > 0:
        with template.ul():
            for key, value in ele.items():
                file_name = curr_beg + "-" + key if len(curr_beg) > 0 else key
                action = ""
                if file_name in all_existing_files:
                    action = file_name
                elif file_name + "-Main" in all_existing_files:
                    action = file_name + "-Main"
                if len(value) > 0:
                    klass = "section"
                    with template.li(klass=klass):
                        template.input(type="checkbox", id=file_name)
                        with template.label(for_=file_name):
                            template.a(href=action, _t=key)
                        beg = curr_beg
                        if len(curr_beg) == 0:
                            beg = key
                        else:
                            beg = beg + "-" + key
                        create_html_tree(template, beg, value,
                                         all_existing_files)
                else:
                    with template.li():
                        template.a(href=action, _t=key)
Ejemplo n.º 2
0
def generate_user_class_html(user_class):
    a = Airium()
    a('<!DOCTYPE html>')
    with a.html(lang="zh-Hans"):
        with a.head():
            a.meta(charset="utf-8")
            a.title(_t=user_class.name)
        with a.body():
            with a.div(id='subject-filter'):
                with a.label():
                    a.input(checked='checked', onchange='changeSubjectFilterAll(this.checked)', type='checkbox')
                    a("全选")
                for key in index_to_subject_name:
                    with a.label():
                        a.input(checked='checked', name='category', onchange='onSubjectCheckboxChange()', type='checkbox',
                                value=key)
                        a(index_to_subject_name[key])
            with a.div(id='user-login'):
                a.label(for_='user-id', _t='用户名:')
                a.input(id='user-id', type='text')
                a.input(onclick='login(document.getElementById("user-id").value)', type='submit', value='登录')
            with a.ul():
                for record in reversed(user_class.lesson_schedules):
                    if not 'title' in record:
                        continue

                    with a.li(klass='lesson-schedule', **{'data-subject': record['numberSubject']}):
                        a.p(klass='lesson-schedule-title', _t=record['title'])
                        if not 'file_resources' in record:
                            continue
                        with a.ul():
                            for resource in record['file_resources']:
                                if not 'fileURI' in resource:
                                    continue
                                with a.li(klass='resource', **{'data-guid': resource['guid']}):
                                    with a.a(href=resource['fileURI']):
                                        a(resource['title'])
                                    if resource['ext'] in pdf_convertable_exts:
                                        a.br()
                                        with a.i():
                                            with a.a(href=resource['fileURI'].replace(resource['ext'], 'pdf')):
                                                a('PDF')
                                    a.br()
                                    a.button(onclick='getAnswerSheet(this)', _t='答题卡')
            with a.script():
                with Path('site/scripts/api.js').open(mode='r') as f:
                    a(f.read())
            with a.script():
                with Path('site/scripts/user-class-page-script.js').open(mode='r') as f:
                    a(f.read())
    return str(a)
Ejemplo n.º 3
0
    def showcase_uhtml(**kwargs):
        html = Airium()

        div_style = 'padding-top:9px'
        if kwargs['is_first']:
            div_style = ('padding-left:6px;'
                         'padding-top:18px;'
                         'min-width:80px;'
                        f'background-image: url(\'{SHOWCASE_BORDER_1}\');'
                         'background-repeat: no-repeat')

        with html.td(style='padding:5px'):
            with html.div(style=div_style):
                html.a(href=kwargs['unit_url'], _t=kwargs['img_uhtml'])
        
        return html
Ejemplo n.º 4
0
    def steam_game_uhtml(**kwargs):
        html = Airium()

        game_stat_style = ('vertical-align:bottom;'
                           'font-size:10px;'
                           'color:#FFF;'
                           'padding: 0px 5px 5px 0px')

        with html.tr():
            html.td(style='padding: 0px 5px 5px 5px',
                    _t=kwargs['img_uhtml'])

            with html.td(align='left', style='vertical-align:top; font-size:10px'):
                html.a(href=kwargs['url'], style='color:#FFF', _t=kwargs['name'])

            with html.td(align='right', style=game_stat_style):
                html(f"""{kwargs['recent_hours']} hrs last 2 weeks""")
                html.br()
                html(f"""{kwargs['total_hours']} hrs total playtime""")

        return html
Ejemplo n.º 5
0
def generate_index_html(user_classes: list, user_class_to_href):
    a = Airium()
    a('<!DOCTYPE html>')
    with a.html(lang="zh-Hans"):
        with a.head():
            a.meta(charset="utf-8")
            a.title(_t='ibuprofen ' + time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()))
        with a.body():
            for user_class in user_classes:
                with a.p():
                    with a.a(href=user_class_to_href(user_class)):
                        a(user_class.name)
    return str(a)
Ejemplo n.º 6
0
def generate_index_html(user: User):
    a = Airium()
    a('<!DOCTYPE html>')
    with a.html(lang="zh-Hans"):
        with a.head():
            a.meta(charset="utf-8")
            a.title(_t='ibuprofen')
        with a.body():
            for user_class in user.user_classes:
                with a.p():
                    with a.a(href='user_class_' + user_class.guid + '.html'):
                        a(user_class.name)
    return str(a)
Ejemplo n.º 7
0
def generate_html(user_class: UserClass):
    a = Airium()
    a('<!DOCTYPE html>')
    with a.html(lang="zh-Hans"):
        with a.head():
            a.meta(charset="utf-8")
            a.title(_t=user_class.name)
        with a.body():
            for record in reversed(user_class.lessons_schedules):
                if not 'title' in record:
                    continue
                with a.p():
                    a(record['title'])
                    with a.i(style="font-size:3px;"):
                        a(record['guid'])
                for resource in record['RefrenceResource']:
                    if not 'fileURI' in resource:
                        continue
                    with a.a(href=resource['fileURI']):
                        a(resource['title'])
                    a.br()
    return str(a)
Ejemplo n.º 8
0
    with a.html(lang="en"):
        with a.head():
            a.meta(charset="utf-8")
            a.title(_t="Index")
            a.style(_t=CSS_STRING())
            # a.script(type="text/javascript", src="index.js")

        with a.body():
            a.h2(_t="Index")

            with a.table(id='table_372'):
                with a.tr():
                    pivot_str = "k \\ g"
                    a.td(_t=pivot_str)
                    for y in cols:
                        column_label = "{:3}".format(y)
                        a.td(_t=column_label)

                for i, x in enumerate(rows):
                    with a.tr():
                        a.td(_t=x)
                        for j, y in enumerate(cols):
                            with a.td():
                                t = filenames[i][j]
                                link = "tables/" + t
                                a.a(href=link, _t="link")

    with open('index.html', "w+") as f:
        f.write(str(a))
Ejemplo n.º 9
0
def generate_html():
    a = Airium()

    a('<!DOCTYPE html>')
    with a.html():
        with a.head():
            a.title(_t="Speech Evaluation")
            a.meta(name="viewport",
                   content="width=device-width, initial-scale=1.0")
            a.link(
                href=
                "https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css",
                rel="stylesheet",
                integrity=
                "sha384-eOJMYsd53ii+scO/bJGFsiCZc+5NDVN2yr8+0RDqr0Ql0h+rP48ckxlpbzKgwra6",
                crossorigin="anonymous")
        with a.body():
            with a.div(klass="container pb-5 pt-5"):
                a.h1(_t="Emotional Speech Evaluation",
                     klass="text-center text-success display-1 pt-5 pb-5")
                a.p(_t=
                    "Thank you for your time and welcome to the subjective evaluation of our emotional speech samples!",
                    klass="pt-5")
                a.p(_t=
                    """First, you will need to answer 5 questions about yourself to make us know you more.
                    Then you will hear overall 80 audio samples, for each of which you are invited to answer 5 questions.
                    If you are uncertain about an answer listen to the audio sample multiple times.
                    """)
                a.p(_t=
                    """It is highly recommended to wear headphones during the evaluation.
                    """)
                with a.p():
                    a.span(
                        _t=
                        """After you click ‘Submit’, all your answers will be recorded, and a CSV file will be
                    downloaded. Please send the CSV file to 
                    """)
                    a.a(href=
                        "mailto:[email protected]?subject=Emotional Speech Evalution",
                        _t="*****@*****.**",
                        target="_blank",
                        rel="noopener noreferrer")
                    a.span(_t=". Thanks for your help!")
                a.p(_t=
                    "Note: Please answer all questions. ‘Submit’ button will bring you back to the unfinished questions."
                    )
                a.p(_t=
                    "When answering questions related to emotions please consider the following definitions:"
                    )
                with a.ul():
                    with a.li():
                        a.span(_t="Please select ")
                        a.strong(_t="‘Neutral’")
                        a.span(
                            _t=
                            " if you think the speaker does not express a particular emotion."
                        )
                    with a.li():
                        a.span(_t="Please select ")
                        a.strong(_t="‘Anger’")
                        a.span(
                            _t=
                            " if you think the speaker is mad or furious about something."
                        )
                    with a.li():
                        a.span(_t="Please select ")
                        a.strong(_t="‘Amused’")
                        a.span(
                            _t=
                            " if you think the speaker finds something funny or interesting."
                        )
                    with a.li():
                        a.span(_t="Please select ")
                        a.strong(_t="‘Disgust’")
                        a.span(
                            _t=
                            " if you think the speaker feels nauseating or disgusted."
                        )
                    with a.li():
                        a.span(_t="Please select ")
                        a.strong(_t="‘Sleepy’")
                        a.span(
                            _t=
                            " if you think the speaker is tired or exhausted.")
                with a.form(klass="pt-5 pb-5",
                            id="evaluation-form",
                            action="#",
                            onsubmit="return submitForm();"):
                    with a.div(klass="form-group col-md-4"):
                        a.label(_t="Name", for_="name-input")
                        a.input(id="name-input",
                                klass="form-control",
                                type="text",
                                placeholder="Jane Smith",
                                required=True)
                    with a.div(klass="form-group col-md-8"):
                        for index, question in enumerate(
                                SELF_EVALUATION_QUESTIONS):
                            with a.div(klass="card mt-5"):
                                with a.div(klass="card-body"):
                                    a.p(_t=question, klass="pb-3")
                                    with a.div(
                                            klass=
                                            "custom-control custom-radio form-check-inline"
                                    ):
                                        a.input(
                                            type="radio",
                                            id=f"self-evaluation-{index}-1",
                                            name=f"self-evaluation-{index}",
                                            klass="custom-control-input",
                                            value=1,
                                            required=True)
                                        a.label(
                                            _t="1 — Strongly disagree",
                                            klass="custom-control-label",
                                            for_=f"self-evaluation-{index}-1")
                                    with a.div(
                                            klass=
                                            "custom-control custom-radio form-check-inline"
                                    ):
                                        a.input(
                                            type="radio",
                                            id=f"self-evaluation-{index}-2",
                                            name=f"self-evaluation-{index}",
                                            klass="custom-control-input",
                                            value=2)
                                        a.label(
                                            _t="2 — Disagree",
                                            klass="custom-control-label",
                                            for_=f"self-evaluation-{index}-2")
                                    with a.div(
                                            klass=
                                            "custom-control custom-radio form-check-inline"
                                    ):
                                        a.input(
                                            type="radio",
                                            id=f"self-evaluation-{index}-3",
                                            name=f"self-evaluation-{index}",
                                            klass="custom-control-input",
                                            value=3)
                                        a.label(
                                            _t="3 — Neutral",
                                            klass="custom-control-label",
                                            name=f"self-evaluation-{index}",
                                            for_=f"self-evaluation-{index}-3")
                                    with a.div(
                                            klass=
                                            "custom-control custom-radio form-check-inline"
                                    ):
                                        a.input(
                                            type="radio",
                                            id=f"self-evaluation-{index}-4",
                                            name=f"self-evaluation-{index}",
                                            klass="custom-control-input",
                                            value=4)
                                        a.label(
                                            _t="4 — Agree",
                                            klass="custom-control-label",
                                            for_=f"self-evaluation-{index}-4")
                                    with a.div(
                                            klass=
                                            "custom-control custom-radio form-check-inline"
                                    ):
                                        a.input(
                                            type="radio",
                                            id=f"self-evaluation-{index}-5",
                                            name=f"self-evaluation-{index}",
                                            klass="custom-control-input",
                                            value=5)
                                        a.label(
                                            _t="5 — Strongly agree",
                                            klass="custom-control-label",
                                            for_=f"self-evaluation-{index}-5")
                    a.h4(_t="Emotional Speech Evalution",
                         klass="mt-5 pt-5 text-success")
                    for index, file in enumerate(get_file_list()):
                        if index % 2 == 1:
                            color_scheme = "bg-secondary bg-gradient text-white"
                        else:
                            color_scheme = "bg-light bg-gradient"
                        with a.div(klass=f"card mt-5 {color_scheme}"):
                            with a.div(klass="card-body"):
                                with a.div(klass="row"):
                                    with a.div(
                                            klass="col-lg-4 align-self-center"
                                    ):
                                        with a.div(klass="text-center"):
                                            a.h6(_t=f"Sample {index + 1}")
                                            a.audio(controls=True,
                                                    src=f"samples/{file}",
                                                    klass='mb-5 mt-5')
                                    with a.div(klass="col-lg-8"):
                                        with a.p(klass="pb-1"):
                                            a.strong(_t="What emotion")
                                            a.span(
                                                _t=
                                                " do you think of the voice expressed?"
                                            )
                                        with a.div(
                                                klass=
                                                "custom-control custom-radio form-check-inline"
                                        ):
                                            a.input(
                                                type="radio",
                                                id=f"tts-evaluation-1-1-{file}",
                                                name=f"tts-evaluation-1-{file}",
                                                klass="custom-control-input",
                                                value=1,
                                                required=True)
                                            a.label(
                                                _t="1 — Neutral",
                                                klass="custom-control-label",
                                                for_=
                                                f"tts-evaluation-1-1-{file}")
                                        with a.div(
                                                klass=
                                                "custom-control custom-radio form-check-inline"
                                        ):
                                            a.input(
                                                type="radio",
                                                id=f"tts-evaluation-1-2-{file}",
                                                name=f"tts-evaluation-1-{file}",
                                                klass="custom-control-input",
                                                value=2)
                                            a.label(
                                                _t="2 — Amused",
                                                klass="custom-control-label",
                                                for_=
                                                f"tts-evaluation-1-2-{file}")
                                        with a.div(
                                                klass=
                                                "custom-control custom-radio form-check-inline"
                                        ):
                                            a.input(
                                                type="radio",
                                                id=f"tts-evaluation-1-3-{file}",
                                                name=f"tts-evaluation-1-{file}",
                                                klass="custom-control-input",
                                                value=3)
                                            a.label(
                                                _t="3 — Anger",
                                                klass="custom-control-label",
                                                for_=
                                                f"tts-evaluation-1-3-{file}")
                                        with a.div(
                                                klass=
                                                "custom-control custom-radio form-check-inline"
                                        ):
                                            a.input(
                                                type="radio",
                                                id=f"tts-evaluation-1-4-{file}",
                                                name=f"tts-evaluation-1-{file}",
                                                klass="custom-control-input",
                                                value=4)
                                            a.label(
                                                _t="4 — Disgust",
                                                klass="custom-control-label",
                                                for_=
                                                f"tts-evaluation-1-4-{file}")
                                        with a.div(
                                                klass=
                                                "custom-control custom-radio form-check-inline"
                                        ):
                                            a.input(
                                                type="radio",
                                                id=f"tts-evaluation-1-5-{file}",
                                                name=f"tts-evaluation-1-{file}",
                                                klass="custom-control-input",
                                                value=5)
                                            a.label(
                                                _t="5 — Sleepy",
                                                klass="custom-control-label",
                                                for_=
                                                f"tts-evaluation-1-5-{file}")

                                        with a.p(klass="pb-1 pt-5"):
                                            a.span(_t="If ")
                                            a.strong(_t="NOT neutral")
                                            a.span(
                                                _t=", what do you think of the "
                                            )
                                            a.strong(_t="intensity")
                                            a.span(
                                                _t=
                                                " of the emotion expressed? (If neutral, please skip this question)"
                                            )
                                        with a.div(
                                                klass=
                                                "custom-control custom-radio form-check-inline"
                                        ):
                                            a.input(
                                                type="radio",
                                                id=f"tts-evaluation-2-1-{file}",
                                                name=f"tts-evaluation-2-{file}",
                                                klass="custom-control-input",
                                                value=1,
                                                required=True)
                                            a.label(
                                                _t="1 — Very weak",
                                                klass="custom-control-label",
                                                for_=
                                                f"tts-evaluation-2-1-{file}")
                                        with a.div(
                                                klass=
                                                "custom-control custom-radio form-check-inline"
                                        ):
                                            a.input(
                                                type="radio",
                                                id=f"tts-evaluation-2-2-{file}",
                                                name=f"tts-evaluation-2-{file}",
                                                klass="custom-control-input",
                                                value=2)
                                            a.label(
                                                _t="2 — Weak",
                                                klass="custom-control-label",
                                                for_=
                                                f"tts-evaluation-2-2-{file}")
                                        with a.div(
                                                klass=
                                                "custom-control custom-radio form-check-inline"
                                        ):
                                            a.input(
                                                type="radio",
                                                id=f"tts-evaluation-2-3-{file}",
                                                name=f"tts-evaluation-2-{file}",
                                                klass="custom-control-input",
                                                value=3,
                                                checked=True)
                                            a.label(
                                                _t="3 — Moderate",
                                                klass="custom-control-label",
                                                for_=
                                                f"tts-evaluation-2-3-{file}")
                                        with a.div(
                                                klass=
                                                "custom-control custom-radio form-check-inline"
                                        ):
                                            a.input(
                                                type="radio",
                                                id=f"tts-evaluation-2-4-{file}",
                                                name=f"tts-evaluation-2-{file}",
                                                klass="custom-control-input",
                                                value=4)
                                            a.label(
                                                _t="4 — Strong",
                                                klass="custom-control-label",
                                                for_=
                                                f"tts-evaluation-2-4-{file}")
                                        with a.div(
                                                klass=
                                                "custom-control custom-radio form-check-inline"
                                        ):
                                            a.input(
                                                type="radio",
                                                id=f"tts-evaluation-2-5-{file}",
                                                name=f"tts-evaluation-2-{file}",
                                                klass="custom-control-input",
                                                value=5)
                                            a.label(
                                                _t="5 — Very strong",
                                                klass="custom-control-label",
                                                for_=
                                                f"tts-evaluation-2-5-{file}")

                                        with a.p(klass="pb-1 pt-5"):
                                            a.strong(_t="How close to human")
                                            a.span(
                                                _t=
                                                " would you rate the voice speaking?"
                                            )
                                        with a.div(
                                                klass=
                                                "custom-control custom-radio form-check-inline"
                                        ):
                                            a.input(
                                                type="radio",
                                                id=f"tts-evaluation-3-1-{file}",
                                                name=f"tts-evaluation-3-{file}",
                                                klass="custom-control-input",
                                                value=1,
                                                required=True)
                                            a.label(
                                                _t="1 — Not at all",
                                                klass="custom-control-label",
                                                for_=
                                                f"tts-evaluation-3-1-{file}")
                                        with a.div(
                                                klass=
                                                "custom-control custom-radio form-check-inline"
                                        ):
                                            a.input(
                                                type="radio",
                                                id=f"tts-evaluation-3-2-{file}",
                                                name=f"tts-evaluation-3-{file}",
                                                klass="custom-control-input",
                                                value=2)
                                            a.label(
                                                _t="2 — A little bit close",
                                                klass="custom-control-label",
                                                for_=
                                                f"tts-evaluation-3-2-{file}")
                                        with a.div(
                                                klass=
                                                "custom-control custom-radio form-check-inline"
                                        ):
                                            a.input(
                                                type="radio",
                                                id=f"tts-evaluation-3-3-{file}",
                                                name=f"tts-evaluation-3-{file}",
                                                klass="custom-control-input",
                                                value=3)
                                            a.label(
                                                _t="3 — Close",
                                                klass="custom-control-label",
                                                for_=
                                                f"tts-evaluation-3-3-{file}")
                                        with a.div(
                                                klass=
                                                "custom-control custom-radio form-check-inline"
                                        ):
                                            a.input(
                                                type="radio",
                                                id=f"tts-evaluation-3-4-{file}",
                                                name=f"tts-evaluation-3-{file}",
                                                klass="custom-control-input",
                                                value=4)
                                            a.label(
                                                _t="4 — Very close",
                                                klass="custom-control-label",
                                                for_=
                                                f"tts-evaluation-3-4-{file}")
                                        with a.div(
                                                klass=
                                                "custom-control custom-radio form-check-inline"
                                        ):
                                            a.input(
                                                type="radio",
                                                id=f"tts-evaluation-3-5-{file}",
                                                name=f"tts-evaluation-3-{file}",
                                                klass="custom-control-input",
                                                value=5)
                                            a.label(
                                                _t="5 — Extremely close",
                                                klass="custom-control-label",
                                                for_=
                                                f"tts-evaluation-3-5-{file}")

                                        with a.p(klass="pb-1 pt-5"):
                                            a.span(
                                                _t="Do you think the voice is "
                                            )
                                            a.strong(
                                                _t="clear and understandable")
                                            a.span(_t="?")
                                        with a.div(
                                                klass=
                                                "custom-control custom-radio form-check-inline"
                                        ):
                                            a.input(
                                                type="radio",
                                                id=f"tts-evaluation-4-1-{file}",
                                                name=f"tts-evaluation-4-{file}",
                                                klass="custom-control-input",
                                                value=1,
                                                required=True)
                                            a.label(
                                                _t="1 — Strongly disagree",
                                                klass="custom-control-label",
                                                for_=
                                                f"tts-evaluation-4-1-{file}")
                                        with a.div(
                                                klass=
                                                "custom-control custom-radio form-check-inline"
                                        ):
                                            a.input(
                                                type="radio",
                                                id=f"tts-evaluation-4-2-{file}",
                                                name=f"tts-evaluation-4-{file}",
                                                klass="custom-control-input",
                                                value=2)
                                            a.label(
                                                _t="2 — Disagree",
                                                klass="custom-control-label",
                                                for_=
                                                f"tts-evaluation-4-2-{file}")
                                        with a.div(
                                                klass=
                                                "custom-control custom-radio form-check-inline"
                                        ):
                                            a.input(
                                                type="radio",
                                                id=f"tts-evaluation-4-3-{file}",
                                                name=f"tts-evaluation-4-{file}",
                                                klass="custom-control-input",
                                                value=3)
                                            a.label(
                                                _t="3 — Neutral",
                                                klass="custom-control-label",
                                                for_=
                                                f"tts-evaluation-4-3-{file}")
                                        with a.div(
                                                klass=
                                                "custom-control custom-radio form-check-inline"
                                        ):
                                            a.input(
                                                type="radio",
                                                id=f"tts-evaluation-4-4-{file}",
                                                name=f"tts-evaluation-4-{file}",
                                                klass="custom-control-input",
                                                value=4)
                                            a.label(
                                                _t="4 — Agree",
                                                klass="custom-control-label",
                                                for_=
                                                f"tts-evaluation-4-4-{file}")
                                        with a.div(
                                                klass=
                                                "custom-control custom-radio form-check-inline"
                                        ):
                                            a.input(
                                                type="radio",
                                                id=f"tts-evaluation-4-5-{file}",
                                                name=f"tts-evaluation-4-{file}",
                                                klass="custom-control-input",
                                                value=5)
                                            a.label(
                                                _t="5 — Strongly agree",
                                                klass="custom-control-label",
                                                for_=
                                                f"tts-evaluation-4-5-{file}")

                                        with a.p(klass="pb-1 pt-5"):
                                            a.span(_t="How much do you ")
                                            a.strong(_t="like")
                                            a.span(_t=" the voice speaking?")
                                        with a.div(
                                                klass=
                                                "custom-control custom-radio form-check-inline"
                                        ):
                                            a.input(
                                                type="radio",
                                                id=f"tts-evaluation-5-1-{file}",
                                                name=f"tts-evaluation-5-{file}",
                                                klass="custom-control-input",
                                                value=1,
                                                required=True)
                                            a.label(
                                                _t="1 — Not at all",
                                                klass="custom-control-label",
                                                for_=
                                                f"tts-evaluation-5-1-{file}")
                                        with a.div(
                                                klass=
                                                "custom-control custom-radio form-check-inline"
                                        ):
                                            a.input(
                                                type="radio",
                                                id=f"tts-evaluation-5-2-{file}",
                                                name=f"tts-evaluation-5-{file}",
                                                klass="custom-control-input",
                                                value=2)
                                            a.label(
                                                _t="2 — Hardly",
                                                klass="custom-control-label",
                                                for_=
                                                f"tts-evaluation-5-2-{file}")
                                        with a.div(
                                                klass=
                                                "custom-control custom-radio form-check-inline"
                                        ):
                                            a.input(
                                                type="radio",
                                                id=f"tts-evaluation-5-3-{file}",
                                                name=f"tts-evaluation-5-{file}",
                                                klass="custom-control-input",
                                                value=3)
                                            a.label(
                                                _t="3 — Moderately",
                                                klass="custom-control-label",
                                                for_=
                                                f"tts-evaluation-5-3-{file}")
                                        with a.div(
                                                klass=
                                                "custom-control custom-radio form-check-inline"
                                        ):
                                            a.input(
                                                type="radio",
                                                id=f"tts-evaluation-5-4-{file}",
                                                name=f"tts-evaluation-5-{file}",
                                                klass="custom-control-input",
                                                value=4)
                                            a.label(
                                                _t="4 — Greatly",
                                                klass="custom-control-label",
                                                for_=
                                                f"tts-evaluation-5-4-{file}")
                                        with a.div(
                                                klass=
                                                "custom-control custom-radio form-check-inline"
                                        ):
                                            a.input(
                                                type="radio",
                                                id=f"tts-evaluation-5-5-{file}",
                                                name=f"tts-evaluation-5-{file}",
                                                klass="custom-control-input",
                                                value=5)
                                            a.label(
                                                _t="5 — Extremely",
                                                klass="custom-control-label",
                                                for_=
                                                f"tts-evaluation-5-5-{file}")
                    with a.div(klass="from-group mt-5"):
                        a.label(
                            _for="open-comments",
                            _t=
                            "Please leave your general opinion about the speeches here. We are also happy to hear your valuable suggestions. Thanks!"
                        )
                        a.textarea(klass="form-control",
                                   id="open-comments",
                                   name="open-comments",
                                   placeholder="(Optional)",
                                   rows="3")
                    a.button(_t="Submit",
                             type="submit",
                             klass="btn btn-primary mt-5")
                    with a.p(klass="mt-3"):
                        a.span(_t="Please send the generated CSV file to ")
                        a.a(href=
                            "mailto:[email protected]?subject=Emotional Speech Evalution",
                            _t="*****@*****.**",
                            target="_blank",
                            rel="noopener noreferrer")
                        a.span(
                            _t=
                            ". Your e-mail address will not be collected or linked with the data. Thanks for your help!"
                        )
        with a.script():
            a(f'''
                function clearForm() {{
                    document.getElementById("evaluation-form").reset();
                }}

                function buildCsvRow(fileName, questionResponses) {{
                    return `${{fileName}};${{questionResponses[0]}};${{questionResponses[1]}};${{questionResponses[2]}};${{questionResponses[3]}};${{questionResponses[4]}}\\n`
                }}

                function getQuestionResponse(input_name) {{
                    return $(`input[name="${{input_name}}"]:checked`).val();
                }}

                function getSelfEvaluationResponses() {{
                    return [{",".join([f"getQuestionResponse('self-evaluation-{index}')" for index in range(5)])}];
                }}

                function getTtsEvaluationResponsesForFile(file_name) {{
                    return [{",".join([f"getQuestionResponse(`tts-evaluation-{index}-${{file_name}}`)" for index in range(1, 6)])}];
                }}

                function getOpenComments() {{
                    let comments = $(`textarea[name="open-comments"]`).val();
                    if ("" === comments) {{
                        return "(Optional)\\n";
                    }} else {{
                        return comments.replace(/\\r?\\n|\\r/g, " ") + "\\n";
                    }}
                }}

                function submitForm() {{
                    let name = $("#name-input").val();
                    let files = [{",".join([f"'{file}'" for file in get_file_list()])}];
                    let csv = "data:text/csv;charset=utf-8,";
                    csv += "filename;q1;q2;q3;q4;q5\\n";
                    csv += buildCsvRow("self_evaluation", getSelfEvaluationResponses());
                    for (let i = 0; i < files.length; i++) {{
                        csv += buildCsvRow(files[i], getTtsEvaluationResponsesForFile(files[i]));
                    }}
                    csv += getOpenComments();
                    let encodedUri = encodeURI(csv);
                    let downloadLink = document.createElement("a");
                    downloadLink.setAttribute("download", `${{name}}_results.csv`);
                    downloadLink.setAttribute("href", encodedUri);
                    document.body.appendChild(downloadLink);
                    downloadLink.click();
                    downloadLink.remove();
                    return false;
                }}
                ''')
        a.script(
            src=
            "https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js",
            integrity=
            "sha384-JEW9xMcG8R+pH31jmWH6WWP0WintQrMb4s7ZOdauHnUtxwoG2vI5DkLtS3qm9Ekf",
            crossorigin="anonymous")
        a.script(
            src="https://code.jquery.com/jquery-3.6.0.min.js",
            integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4=",
            crossorigin="anonymous")

    return str(a)