# homework **Repository Path**: eoam/homework ## Basic Information - **Project Name**: homework - **Description**: No description available - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2026-03-01 - **Last Updated**: 2026-03-01 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Picture Question Bank Generator A web application that extracts questions from images using OCR and generates detailed answers using AI. ## Features - Image upload with drag & drop support - OCR text extraction using Tesseract - Automatic question parsing - AI-powered answer generation (GLM API) - Modern Vue.js frontend with Element Plus ## Prerequisites - Java 17+ - Maven 3.6+ - Node.js 18+ (for frontend development) - Tesseract OCR installed on your system ### Installing Tesseract **Windows:** ```bash # Download from: https://github.com/UB-Mannheim/tesseract/wiki # Install to default location or set TESSDATA_PREFIX environment variable ``` **macOS:** ```bash brew install tesseract tesseract-lang ``` **Linux (Ubuntu/Debian):** ```bash sudo apt-get install tesseract-ocr tesseract-ocr-chi-sim ``` ## Quick Start ### Backend ```bash # Navigate to project root cd image-quiz-generator # Build the project mvn clean install # Run the application mvn spring-boot:run ``` The backend will start on http://localhost:8080 ### Frontend ```bash cd frontend # Install dependencies npm install # Start development server npm run dev ``` The frontend will start on http://localhost:5173 ## Configuration ### GLM API Key Set your GLM API key via environment variable: ```bash # Linux/macOS export GLM_API_KEY=your-api-key-here # Windows (PowerShell) $env:GLM_API_KEY="your-api-key-here" ``` Or update `src/main/resources/application.yml`: ```yaml app: glm: api-key: your-api-key-here ``` ### Tesseract Language Default is Chinese Simplified + English. To change: ```yaml app: ocr: language: eng # English only # language: chi_sim+eng # Chinese + English # language: chi_tra # Traditional Chinese ``` ## API Endpoints | Method | Endpoint | Description | |--------|----------|-------------| | POST | /api/upload | Upload image and process | | GET | /api/health | Health check | ### Upload Example ```bash curl -X POST http://localhost:8080/api/upload \ -F "file=@/path/to/image.png" ``` Response: ```json { "ocrText": "识别出的文本内容...", "questions": [ { "index": 1, "content": "题目内容", "type": "选择题", "options": ["A. 选项1", "B. 选项2"], "answer": "A", "explanation": "详细解析" } ], "totalTimeMs": 3500 } ``` ## Project Structure ``` . ├── pom.xml # Maven configuration ├── src/ │ └── main/ │ ├── java/com/example/quiz/ │ │ ├── ImageQuizGeneratorApplication.java │ │ ├── config/ # Configuration classes │ │ ├── controller/ # REST controllers │ │ ├── dto/ # Data transfer objects │ │ └── service/ # Business logic │ └── resources/ │ └── application.yml ├── frontend/ # Vue.js frontend │ ├── src/ │ │ ├── App.vue │ │ └── main.js │ ├── index.html │ ├── package.json │ └── vite.config.js └── uploads/ # Uploaded files (auto-created) ``` ## Tech Stack **Backend:** - Spring Boot 3.2 - Tesseract4j (Tess4J) - OkHttp - Jackson **Frontend:** - Vue.js 3 - Vite - Element Plus - Axios