Download tab_chapter.py from clr/toh26: direct link, hf CLI and curl.
- Browser
- Download file 2.21 kB
-
https://huggingface.co/spaces/clr/toh26/resolve/main/tab_chapter.py
- Command line
-
hf download hf://spaces/clr/toh26/tab_chapter.py
-
curl -L -o tab_chapter.py https://huggingface.co/spaces/clr/toh26/resolve/main/tab_chapter.py
2.21 kB
| import gradio as gr | |
| import data | |
| def chapter_tab(book, folder): | |
| kaf_opts = data.kafli_choices(book) | |
| first_kaf = kaf_opts[0][1] | |
| aef_opts = data.aefing_choices(book, first_kaf) | |
| with gr.Row(equal_height=True): | |
| kaf = gr.Dropdown(kaf_opts, value=first_kaf, label="Kafli", scale=1, filterable=False) | |
| aef = gr.Dropdown(aef_opts, value=aef_opts[0][1], label="Hljóðskynjun", scale=2, filterable=False) | |
| lengd = gr.Radio(data.LENGD_SEL, value="langt", label="Lengd", scale=1) | |
| with gr.Column(scale=1, min_width=200): | |
| hint = gr.Checkbox(True, label="Gefa vísbendingar") | |
| spectro = gr.Checkbox(False, label="Sýna hljóðrófsrit") | |
| go = gr.Button("Byrja", variant="primary", scale=1, min_width=100) | |
| def on_kafli(n_kaf): | |
| opts = data.aefing_choices(book, n_kaf) | |
| return gr.update(choices=opts, value=opts[0][1]) | |
| kaf.change(on_kafli, kaf, aef) | |
| state = data.exercise_panel() | |
| def practise(n_kaf, n_aef, lengd_, hint_, spectro_): | |
| items = data.make_exercises_for_chapter(book, folder, n_kaf, n_aef, lengd_) | |
| return data.new_exercise_set(items, hint_, header=data.chapter_header(book, n_kaf, n_aef), | |
| spectro=spectro_) | |
| data.wire_generate(go, state, [kaf, aef, lengd, hint, spectro], practise) | |
| def about_tab(): | |
| gr.Markdown(""" | |
| # ⚠ Þetta er máltæknileg tilraun | |
| - [sjálfvirk greining](https://github.com/catiR/ISE054GTogHh26/tree/main/scripts) finnur rangt/ónýtt/ekkert hljóð fyrir nokkur orð | |
| - nú sem stendur hafa nokkrar villur verið leiðréttar en kannski ekki allar | |
| - fyrir nemendur ÍSE054G, **óopinbert**, fylgir sjálfsnám "Skynjun sérhljóða og samhljóða" (María Garðarsdóttir og Sigríður Þorvaldsdóttir) | |
| - spurningar, yfirlestur (takk!!), ... ⟶ caitlinr@ru.is (clr6@hi.is) | |
| - ég á ekkert og þetta er ekki leyfð að deila með öðrum | |
| ### 📍 Síðan virkar best á https://clr-toh26.hf.space/ | |
| - afsakið slæm gæði en ég er ekki og vil ekki vera vefforitari! | |
| """) | |