Spaces:
Paused
Paused
|
Download README.md from jobinv/MathematicsApps: direct link, hf CLI and curl.
- Browser
- Download file 17.8 kB
-
https://huggingface.co/spaces/jobinv/MathematicsApps/resolve/main/README.md
- Command line
-
hf download hf://spaces/jobinv/MathematicsApps/README.md
-
curl -L -o README.md https://huggingface.co/spaces/jobinv/MathematicsApps/resolve/main/README.md
17.8 kB
| title: M1 Mechanics Quest | |
| emoji: ๐ | |
| colorFrom: indigo | |
| colorTo: pink | |
| sdk: gradio | |
| sdk_version: 6.24.0 | |
| app_file: app.py | |
| pinned: false | |
| license: mit | |
| short_description: Gamified IAL M1 practice with 3D diagrams | |
| # M1 Mechanics Quest | |
| A polished Hugging Face Gradio Space for original Pearson Edexcel International | |
| Advanced Level Mechanics 1-style practice. | |
| ## What is included | |
| - deterministic, seeded generators for eight M1 skill zones; | |
| - an always-visible two-row workspace navigator: all 12 primary tabs appear as | |
| six tabs per row, remain available while scrolling within the workspace, and | |
| are never moved into Gradio's three-dot overflow menu; | |
| - original multi-part exam-style questions and validated worked solutions; | |
| - a question-driven visual concept studio on every generated mission: first a | |
| graphical picture, then parameter-accurate animation, then editable sliders | |
| for exploring changed mass, velocity, acceleration, friction, force, time, | |
| angle, gravity and other relevant factors; | |
| - 2D exam line diagrams and rotatable colour 3D concept models; | |
| - a dynamic Creative Mechanics Lab with roller collision, electric train, | |
| rocket launch and cargo trolley experiments; object, setting, question, | |
| diagrams, theory and worked solution all change from the same parameters; | |
| - visual controls for mass/size, distance, velocity, acceleration, braking, | |
| gravity, friction, force and angle, depending on the selected experiment; | |
| - click-to-start object-specific motion with rebound, acceleration/cruising/ | |
| braking, ascent/landing and rough-floor effects; | |
| - local real-time sound cues, lights, shockwaves, sparks and optional very-light | |
| synthesized background musicโno audio files or network stream required; | |
| - photo/webcam upload for handwritten work on generated and custom missions; | |
| - local OCR plus exact numeric checking; | |
| - optional multimodal review when an OpenAI API key is configured; | |
| - colourful topic-aware correction animation; | |
| - theory notes, hints, method marks and modelling assumptions; | |
| - XP, levels, streaks, hearts, badges and topic mastery; | |
| - custom questions with synchronized motion replay, worked solutions and downloads; | |
| - a **Question Intake** workspace that accepts pasted text, `.txt`, `.md`, | |
| `.json`, images, PDF, Word `.doc/.docx`, uploaded audio and microphone input; | |
| - automatic text extraction/OCR/transcription, numbered-question splitting, | |
| duplicate detection, mechanics-concept identification, and an editable visual | |
| model for each newly added question; | |
| - a reusable user question bank with JSON backup and restore-by-upload, extending | |
| the original mapping of 149 reference questions without rebuilding the app; | |
| - a **Mechanics Tutor Chat** automatically grounded in the active generated | |
| question, verified solution, expected answers, hints and theory; | |
| - six suggested clarification prompts plus free-form follow-up questions using | |
| typed text, microphone/uploaded audio, or an uploaded equation, diagram or | |
| handwritten image; | |
| - a grounded open-source tutor using selectable Qwen models through Hugging | |
| Face Inference Providers, with automatic verified-local fallback; | |
| - a deterministic local tutor for core explanations and image/OCR checking, | |
| plus an optional OpenAI route when `OPENAI_API_KEY` is configured; | |
| - three fixed native **Ask Teacher** bots at the top-right, middle-right, and | |
| bottom-right on the first page and every tab; each opens over the page without | |
| changing tabs, maintains an independent mission-linked conversation, uses the | |
| same Qwen/local/OpenAI routes, and links to the full multimodal tutor; | |
| - a protected **Examination lock** that disables the mission generator, every | |
| training tab, worksheet tools, theory, progress, and all Ask Teacher bots during an | |
| active attempt; | |
| - reproducible **Midterm 1** and **Midterm 2** papers with 10 questions each by | |
| default, plus a default 25-question **Final examination**; all three question | |
| counts can be changed before the protected attempt starts; | |
| - nine assessment formats: multiple choice, fill-in-the-blank, numerical | |
| problem, explanation, theory, mathematical calculation, match the following, | |
| diagram interpretation, and paragraph analysis; | |
| - a 10-minute locked reading/setup phase, configurable protected-session clock | |
| up to 130 minutes, deadline auto-submission, and optional per-question pacing | |
| timers assigned through 1โ7 minute question-number lists; | |
| - one answer field per question, numbered handwritten image/PDF answer-sheet | |
| OCR, deterministic rubric-based marking, typed-versus-OCR mismatch flags, | |
| post-submission solutions, and a flattened encrypted PDF containing the | |
| questions, responses, marks, and solutions; | |
| - a separate **Assignments** studio with an adjustable question count, original | |
| assignment generation, numbered typed/image/PDF submission, evaluation, | |
| solutions, and a downloadable report; | |
| - an **Extraordinary Activities** record for assessed projects, competitions, | |
| investigations, presentations, prototypes, tutoring, outreach, and other | |
| work outside the three protected examinations and assignments, including | |
| optional image/PDF/Word evidence; | |
| - an **Outcome-Based Education (OBE)** calculator on a maximum attainment of | |
| 3.000, with editable component percentages, automatic latest-score loading, | |
| a transparent contribution table, and a fixed 0โ3 Plotly spider chart; | |
| - default OBE weights of 10% Midterm 1, 10% Midterm 2, 10% Assignment, 50% | |
| Final examination, and 20% Extraordinary activities, which correspond to | |
| maximum contributions of 0.3, 0.3, 0.3, 1.5, and 0.6; | |
| - a question-by-question **Mistake Analysis** studio that reports the response, | |
| marking feedback, correct answer, topic/format success rates, strengths, | |
| weaknesses, opportunities, challenges, and a prioritized improvement plan; | |
| - a mistake-analysis chatbot grounded in the selected completed assessment, | |
| with Qwen, verified-local, and optional OpenAI tutor routes; | |
| - congratulatory standard, silver distinction, gold excellence, and diamond | |
| achievement certificate previews with rendered ribbon/medal artwork and a | |
| print-enabled, edit-locked, verification-coded PDF download; | |
| - a classroom worksheet generator with teacher solutions in Markdown, editable | |
| Word, and print-ready PDF formats. | |
| ## Skill coverage | |
| 1. vertical motion under gravity; | |
| 2. speedโtime graphs and area/gradient reasoning; | |
| 3. impulse, momentum and direct collisions; | |
| 4. moments, reactions, uniform beams and tilting; | |
| 5. friction and limiting equilibrium; | |
| 6. connected particles on rough inclined planes; | |
| 7. two-dimensional vector motion and bearings; | |
| 8. force resolution and particle equilibrium. | |
| ## Deploy on Hugging Face Spaces | |
| 1. **Extract the ZIP first. Do not upload the unopened ZIP as a single file.** | |
| 2. Create a new **Gradio** Space. | |
| 3. Upload every extracted file. The app now has embedded styling and also ships | |
| a root-level `style.css`, so a missing `assets` folder will not stop startup. | |
| The required Hugging Face application entry point is **`app.py`**, located | |
| at the root beside this README. | |
| 4. The Space installs Python dependencies from `requirements.txt`, and installs | |
| Tesseract, Antiword and FFmpeg from `packages.txt`. | |
| 5. Wait for the build to complete and open the Space. | |
| No secret is required for generation, diagrams, theory, OCR, numeric marking, | |
| gamification, worksheets, or local audio transcription. The first local audio | |
| transcription downloads the compact Whisper model selected by | |
| `LOCAL_WHISPER_MODEL` (default: `tiny.en`). | |
| ### Open-source Qwen tutor | |
| Both tutor interfaces use **Open-source Qwen (Hugging Face)** by default. Add | |
| an `HF_TOKEN` Space secret with permission to call Inference Providers. The | |
| student can select `Qwen/Qwen3-4B-Instruct-2507` (default), | |
| `Qwen/Qwen3-30B-A3B-Instruct-2507`, or `Qwen/Qwen2.5-7B-Instruct`. | |
| Each request includes the active problem, verified solution path, accepted | |
| answers, hints, theory and recent conversation. If the token, selected model or | |
| provider is unavailable, the app reports the fallback and answers with the | |
| verified local tutor. Optional overrides are `HF_TUTOR_MODEL`, | |
| `HF_INFERENCE_PROVIDER` and `HF_TUTOR_TIMEOUT`. | |
| ### Question Intake and storage | |
| Open **โ Question intake** to extend the app with a new user guide: | |
| 1. paste questions, upload one or several supported files, or record a spoken | |
| question; | |
| 2. select **Automatic detection** or provide a concept hint; | |
| 3. choose whether numbered questions should be split; | |
| 4. click **Extract, visualize, and add to bank**; | |
| 5. inspect the extracted text and use the editable animation to verify the | |
| interpreted parameters; | |
| 6. download the JSON question-bank backup when required. Uploading that JSON | |
| through Question Intake restores its question prompts with deduplication. | |
| On standard free Space hardware, newly added records are stored in the running | |
| Space filesystem and can be lost when the Space restarts. For permanent server- | |
| side retention, enable Hugging Face Persistent Storage and set | |
| `M1_QUESTION_BANK_PATH` to a file under the mounted persistent directory. The | |
| JSON download remains the portable backup method. | |
| For higher-quality speech transcription, set `OPENAI_API_KEY`; the optional | |
| `TRANSCRIPTION_MODEL` defaults to `gpt-4o-mini-transcribe`. Without that key, | |
| audio is processed locally. | |
| ### Optional vision tutor | |
| For step-level interpretation of handwritten work, add these Space secrets: | |
| - `OPENAI_API_KEY` โ API credential; | |
| - `VISION_MODEL` โ optional model override; defaults to `gpt-4.1-mini`. | |
| - `TUTOR_MODEL` โ optional chatbot model override; defaults to `gpt-4.1-mini`. | |
| The learner must also tick **Use optional AI vision tutor** for a submission. | |
| When it is not ticked, the work image stays in the Space runtime and is handled | |
| by local OCR. If optional vision is enabled, the uploaded image is sent to the | |
| configured API for that review. | |
| ### Mechanics Tutor Chat | |
| Three fixed **Ask Teacher** launchers stay at the top-right, middle-right, and | |
| bottom-right on Mission Control and every other tab. Each is a complete native | |
| Gradio copy with its own compact chat, text field, First hint, Equation choice, | |
| Clear, model selector, Enter submission, close control, and full-tutor link. | |
| Opening one closes the other panels to prevent overlap. Every copy follows the | |
| current Mission Control or Creative Lab problem and its verified solution. | |
| Qwen is the default engine; | |
| the verified local and optional OpenAI engines remain selectable. Select **Open full | |
| multimodal tutor โ** inside the popup only when voice or image input is needed; | |
| that explicit link opens the existing Mechanics Tutor Chat tab in the same | |
| browser window. | |
| The **๐ฌ Mechanics tutor chat** tab follows the current Mission Control | |
| question. Generating a new mission resets and re-grounds the conversation. | |
| Students may select one of six suggested questions, type a follow-up, record a | |
| voice query, or upload an equation/diagram/working image. Voice is transcribed | |
| using the same local-or-configured transcription route as Question Intake. | |
| The Qwen engine handles open-ended clarification while remaining constrained by | |
| validated question data. The verified local tutor can explain theory, | |
| equations, sign conventions, first hints, complete solutions, similar questions | |
| and OCR-detected checkpoints without a key. The optional OpenAI engine uses | |
| `OPENAI_API_KEY`. | |
| ### Protected examinations | |
| Turn on **Activate examination section** above the mission generator. The app | |
| hides and disables all training tabs and the three Ask Teacher launchers. After | |
| the learner starts a paper, the examination switch and paper settings stay | |
| locked until the attempt is submitted. Midterm 1 and Midterm 2 default to 10 | |
| questions and the Final examination defaults to 25; independent sliders can | |
| change each paper size before starting. Papers rotate through nine formats: | |
| multiple choice, fill-in-the-blank, numerical problem, explanation, theory, | |
| mathematical calculation, match the following, diagram interpretation, and | |
| paragraph analysis. | |
| The protected-session duration defaults to 130 minutes and may be reduced | |
| manually. The first 10 minutes are reserved for preliminary reading and setup; | |
| answer fields and individual timers unlock after that phase. The remaining | |
| default 120 minutes are examination time. Small questions receive a suggested | |
| 1-minute timer and descriptive questions receive 4 minutes. Question numbers | |
| can be reassigned manually to any 1โ7 minute list. Individual timers are pacing | |
| aids; the main clock continues whether or not they are started. At the deadline, | |
| answer controls lock and the result/PDF submission runs automatically. | |
| The protected browser tab must remain open so its live answers can be captured | |
| and submitted at the deadline. | |
| The learner can type an answer beneath every question and optionally upload | |
| numbered handwritten images or a PDF. Write `Q1`, `Q2`, and so on clearly on | |
| the sheet. Typed answers remain authoritative; OCR fills an empty typed answer | |
| only, and any typed/OCR mismatch is shown for human review. Solutions are | |
| hidden until submission. The downloadable result is a flattened, encrypted PDF | |
| with printing permission but without editing, annotation, form-filling, | |
| assembly, or extraction permissions in compliant PDF readers. | |
| This in-app lock prevents access to the application's own learning tools. A | |
| managed browser or formal invigilation is still necessary to prevent access to | |
| outside websites, phones, notes, or other devices. | |
| ### Assignments | |
| Open **๐ Assignments** during training mode. Select the completed topics, set | |
| the assignment question count from 1 to 30, and generate an original paper. | |
| Students can submit typed answers using `Q1`, `Q2`, โฆ headings or upload | |
| numbered handwritten images/PDF. Evaluation reveals the question-by-question | |
| feedback and solutions and creates a downloadable result report. | |
| ### Extraordinary activities, OBE, and attainment evidence | |
| Open **๐ Extraordinary activities** to record one or more activities outside | |
| Midterm 1, Midterm 2, assignments, and the Final examination. Each record has | |
| obtained and maximum marks and can include optional evidence. Multiple activity | |
| marks are added before their combined ratio is used by OBE. | |
| Completed protected examinations and assignments are stored in session | |
| assessment history automatically. In **๐ OBE attainment**, click **Load latest | |
| recorded scores** to copy the newest result of each type plus the combined | |
| extraordinary-activity score. Every mark field remains editable for moderation. | |
| The calculation for each component is: | |
| `3 ร component percentage weight รท 100 ร (marks obtained รท maximum marks)` | |
| The five weight percentages must total 100. The defaults are 10%, 10%, 10%, | |
| 50%, and 20%, so a fully attained student receives contributions of 0.3, 0.3, | |
| 0.3, 1.5, and 0.6, totaling 3.000. A fixed 0โ3 spider chart displays the | |
| unweighted attainment level reached within each component so component shapes | |
| remain directly comparable. | |
| ### Mistake analysis and certificates | |
| Open **๐งญ Mistake analysis**, refresh completed assessments, select an attempt, | |
| and click **Analyse mistakes**. The report reveals each lost-mark response, | |
| marker feedback, correct answer, topic-specific next action, performance by | |
| topic and question format, and a strengths/weaknesses/opportunities/challenges | |
| summary. Its dedicated chatbot uses the selected correction record as verified | |
| context and can explain or defend the analysis. | |
| Open **๐ Certificates** after computing OBE attainment. To avoid gaps created | |
| by overlapping wording, the app uses these continuous bands: | |
| | Attainment | Overall percentage | Certificate | | |
| |---:|---:|---| | |
| | Below 1.800 | Below 60% | Not generated | | |
| | 1.800 to below 2.400 | 60% to below 80% | Standard achievement | | |
| | 2.400 to below 2.700 | 80% to below 90% | Silver distinction | | |
| | 2.700 to below 2.900 | 90% to below 96.67% | Gold excellence | | |
| | 2.900 to 3.000 | 96.67% to 100% | Diamond achievement | | |
| The exact phrase **100 percent achievement** appears only when attainment is | |
| 3.000/3.000. Every eligible certificate congratulates the student, shows the | |
| actual score, includes programmatically rendered ribbon/medal artwork, and is | |
| downloaded as an encrypted PDF that permits printing but not editing. | |
| ### Creative Lab sound | |
| Browsers permit sound after a learner gesture. Clicking the model or **Start | |
| experiment** unlocks audio. The collision, train horn, rocket whoosh, landing | |
| and friction sounds are generated locally at the matching event. Learners can | |
| independently turn off experiment sounds and light background music. | |
| ## Local run | |
| For an obvious browser-opening launcher, run: | |
| ```bash | |
| python launch_app.py | |
| ``` | |
| Windows users can instead double-click `run_app_windows.bat`. Linux and macOS | |
| users can run `bash run_app_linux_mac.sh`. | |
| The Hugging Face entry point can also be run directly: | |
| ```bash | |
| python -m pip install -r requirements.txt | |
| python app.py | |
| ``` | |
| ## Validation | |
| ```bash | |
| python -m unittest discover -s tests -v | |
| ``` | |
| The tests exercise every procedural generator across difficulties and seeds, | |
| all eight editable visual scenes, question ingestion/deduplication, multimodal | |
| tutor grounding, answer matching, gamification, Plotly figure creation and | |
| worksheet output. | |
| ## Content and affiliation notice | |
| The supplied past-paper images were used only to map topic coverage, command | |
| words, diagram types and typical mark structures. They are not bundled or | |
| transcribed. Every question emitted by this Space is procedurally generated | |
| original practice content. | |
| This project is unofficial and is not affiliated with, endorsed by, or an | |
| official product of Pearson Edexcel. Pearson and Edexcel are trademarks of | |
| their respective owner. | |