Skip to content

feat: add standalone interactive practice UI#18

Open
HareshKarnan wants to merge 2 commits intoduoan:masterfrom
HareshKarnan:torchcodeUI
Open

feat: add standalone interactive practice UI#18
HareshKarnan wants to merge 2 commits intoduoan:masterfrom
HareshKarnan:torchcodeUI

Conversation

@HareshKarnan
Copy link
Copy Markdown

This PR introduces a standalone, modern web interface for practicing PyTorch implementations, providing a more focused and platform-native experience compared to the traditional Jupyter Notebook workflow.

Key Features:

  • Dual-Pane Layout: Integrated problem description on the left and a professional-grade Monaco code editor on the right.
  • Real-Time Feedback: Execute code and receive instant, structured test results with pass/fail indicators, execution time, and detailed error tracebacks.
  • LaTeX Math Rendering: Problem descriptions and hints now render mathematical formulas beautifully using KaTeX.
  • Auto-Persistence: User code is automatically saved to browser local storage, preventing data loss on reloads.
  • Progress Tracking: Automatically marks problems as solved when all tests pass, with visual indicators in the problem viewer and a difficulty-grouped task selector.
  • Pure English: All original Chinese comments and instructions have been translated to English for broader accessibility.

Technical Architecture:

  • Frontend: Next.js (React) with Tailwind CSS and Monaco Editor.
  • Backend: FastAPI (Python) serving a custom execution engine (web_engine.py) that safely executes user code strings in isolated namespaces.
  • Integration: Automatically parses existing Jupyter templates to extract problem content and initial code snippets.

How to run:

  1. pip install -r api/requirements.txt && python -m uvicorn api.main:app --port 8000 --reload
  2. cd web && npm install && npm run dev
  3. Visit http://localhost:3000

This introduces a Next.js frontend and FastAPI backend for the TorchCode practice environment. Math formulas have been updated to use LaTeX, and Chinese characters have been translated to English. References to LeetCode have been removed for legal safety.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant