--- title: Classroom emoji: 🎓 colorFrom: indigo colorTo: blue sdk: gradio sdk_version: 5.23.0 python_version: '3.12' app_file: app.py pinned: false --- # Classroom A shared prompting classroom on Hugging Face Spaces. - **Student tab** — students join with their name and the class code, then chat with the model. - **Follow the teacher tab** — a read-only, live feed of the teacher's prompts and answers. - **Teacher tab** (needs the teacher code) — your own prompt box (feeds the live view), every student prompt and answer, token usage per person, and a CSV export. Data is kept in memory only. It resets when the Space restarts or goes to sleep, so export the CSV before the end of class. ## Setup 1. Create a new Space at https://huggingface.co/new-space and pick the **Gradio** SDK. 2. Upload `app.py`, `requirements.txt` and this `README.md` (or `git push` them to the Space repo). 3. Under **Settings → Variables and secrets**, add these: | Name | Kind | Value | |------|------|-------| | `OPENAI_API_KEY` | Secret | Your OpenAI API key | | `CLASS_CODE` | Secret | The code you give students | | `TEACHER_CODE` | Secret | Your own code for the Teacher tab | | `OPENAI_MODEL` | Variable (optional) | Model name, default `gpt-4o-mini` | | `TOKEN_LIMIT_PER_STUDENT` | Variable (optional) | Max tokens per student, `0` = unlimited (the default) | 4. Share the Space URL (`https://huggingface.co/spaces//`) and the class code. > The Space must be **public** (or students must have access to it) for them to open the URL. > All usage is billed to your OpenAI key, so consider setting `TOKEN_LIMIT_PER_STUDENT`. ## Run locally ```bash pip install gradio==5.23.0 -r requirements.txt export OPENAI_API_KEY=... CLASS_CODE=abc TEACHER_CODE=xyz python app.py ```