Skip to content

Repository files navigation

YLE//EX

Prototype: Yle RSS headlines → ChatGPT language exercises. Flask + nginx.

Run

  1. Put your key in secrets.env:
OPENAI_API_KEY=sk-...
OPENAI_MODEL=gpt-5.6
  1. Dev server:
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
python app.py

Open http://127.0.0.1:5000

A background thread polls the Yle RSS feed every 60s and writes exercises into data/yleex.sqlite. The dashboard lists only items whose full exercise set is already cached. Luo uudelleen is per browser session and is not written back to that cache.

  1. Gunicorn (what nginx proxies to):
chmod +x run.sh
./run.sh

Listens on 127.0.0.1:11224. Cache only (no RSS, no new LLM calls):

./run.sh --cached

Or YLEEX_WORKER=0 in secrets.env / the environment. Luo uudelleen is also disabled in that mode.

  1. Nginx on the TurkuNLP host: install nginx/yle-ex.conf and get a separate Let's Encrypt cert for yle-ex.turkunlp.org (the churchbook/rag cert will not match):
sudo certbot --nginx -d yle-ex.turkunlp.org
sudo nginx -t && sudo systemctl reload nginx

Add an exercise

Drop a YAML file in prompts/. Filename sort order is display order.

id: my_new_type
name: Nimi
name_en: English name
blurb: Short description
ui: quiz          # cards | quiz | cloze | qa
temperature: 0.4
system: |
  Reply with a single JSON object only.
user: |
  Title: {{title}}
  Lead: {{summary}}
  Tags: {{categories}}

Placeholders: {{title}} {{summary}} {{article}} {{categories}} {{link}} {{published}}.

JSON shapes:

  • cards: { intro, cards: [{ front, back, example, note }] }
  • quiz: { intro, questions: [{ q, options, answer, explain }] } (answer is 0-based index)
  • cloze: { intro, passages: [{ text, answers, hints }] } (blanks are ___)
  • qa: { intro, model_text, items: [{ prompt, sample }] }

If you change a prompt, cached answers for that type are rebuilt automatically.

Exercises use the full Yle article text (fetched from the item link) plus title and lead. Title links go to yle.fi.

About

A little prototype to make learning examples out of yle news

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages