### Install Project Requirements - Shell Source: https://github.com/lyihub/mad-professor-public/blob/main/README.md Installs all remaining project dependencies listed in the 'requirements.txt' file using pip. ```Shell pip install -r requirements.txt ``` -------------------------------- ### Install Magic-PDF Dependency - Shell Source: https://github.com/lyihub/mad-professor-public/blob/main/README.md Installs the 'magic-pdf' library with full dependencies from a specified PyPI mirror. This library is crucial for PDF processing. ```Shell pip install -U magic-pdf[full]==1.3.3 -i https://mirrors.aliyun.com/pypi/simple ``` -------------------------------- ### Run the Application - Shell Source: https://github.com/lyihub/mad-professor-public/blob/main/README.md Executes the main Python script to start the 'Mad Professor' application. ```Shell python main.py ``` -------------------------------- ### Install FAISS GPU Version - Shell Source: https://github.com/lyihub/mad-professor-public/blob/main/README.md Installs the GPU-enabled version of the FAISS library using conda. This is required for efficient vector retrieval in the RAG system. ```Shell conda install -c conda-forge faiss-gpu ``` -------------------------------- ### Install PyTorch with CUDA and Numpy - Shell Source: https://github.com/lyihub/mad-professor-public/blob/main/README.md Installs specific versions of torch, torchvision, and torchaudio compatible with CUDA 12.4, forcing reinstallation and constraining the numpy version. Adjust the index URL and CUDA version based on your system configuration. ```Shell pip install --force-reinstall torch torchvision torchaudio "numpy<=2.1.1" --index-url https://download.pytorch.org/whl/cu124 ``` -------------------------------- ### HTML Starter Template for KaTeX CDN Source: https://github.com/lyihub/mad-professor-public/blob/main/assets/katex/README.md Provides a basic HTML document structure including the necessary CDN links for KaTeX CSS and JavaScript, along with the auto-render extension, configured to render math in the document body on load. Requires the HTML5 doctype. ```html
... ``` -------------------------------- ### Generating HTML String from Math Expression (katex.renderToString) Source: https://github.com/lyihub/mad-professor-public/blob/main/assets/katex/README.md Shows how to use the `katex.renderToString` function to generate an HTML string representation of a TeX math expression. Useful for server-side rendering. Includes an option to prevent throwing errors. Requires KaTeX CSS and fonts for display. ```javascript var html = katex.renderToString("c = \\pm\\sqrt{a^2 + b^2}", { throwOnError: false }); // '...' ``` -------------------------------- ### Rendering Math Directly into a DOM Element (katex.render) Source: https://github.com/lyihub/mad-professor-public/blob/main/assets/katex/README.md Demonstrates how to use the `katex.render` function to render a TeX math expression directly into a specified HTML DOM element. Includes an option to prevent throwing errors on invalid input. Requires KaTeX CSS and fonts. ```javascript katex.render("c = \\pm\\sqrt{a^2 + b^2}", element, { throwOnError: false }); ``` -------------------------------- ### Configure DeepSeek API Keys - Python Source: https://github.com/lyihub/mad-professor-public/blob/main/README.md This Python code snippet shows where to configure the base URL and API key for the DeepSeek LLM service within the `config.py` file. ```Python API_BASE_URL = "YOUR_API_URL" API_KEY = "YOUR_API_KEY" ``` -------------------------------- ### Configure Device Mode - JSON Source: https://github.com/lyihub/mad-professor-public/blob/main/README.md This JSON snippet shows how to modify the user's magic-pdf.json configuration file to enable CUDA support for GPU acceleration. ```JSON { "device-mode":"cuda" } ``` -------------------------------- ### Configure MiniMax TTS API Keys - Python Source: https://github.com/lyihub/mad-professor-public/blob/main/README.md This Python code snippet shows where to configure the group ID and API key for the MiniMax TTS service within the `config.py` file. ```Python TTS_GROUP_ID = "YOUR_MINIMAX_GROUP_ID" TTS_API_KEY = "YOUR_MINIMAX_API_KEY" ``` -------------------------------- ### Create & Activate Conda Environment - Shell Source: https://github.com/lyihub/mad-professor-public/blob/main/README.md This command sequence creates a new conda environment named 'mad-professor' with a specific Python version and then activates it. This isolates the project's dependencies. ```Shell conda create -n mad-professor python=3.10.16 conda activate mad-professor ``` -------------------------------- ### Download Models - Shell Source: https://github.com/lyihub/mad-professor-public/blob/main/README.md Executes a Python script that automatically downloads necessary model files and configures the model directory in the user's magic-pdf.json configuration file. ```Shell python download_models.py ``` -------------------------------- ### Configure AI Character Prompt Path - Python Source: https://github.com/lyihub/mad-professor-public/blob/main/README.md This Python code snippet shows how to modify the `AI_CHARACTER_PROMPT_PATH` variable in `AI_professor_chat.py` to specify the path to a custom AI character prompt file. ```Python AI_CHARACTER_PROMPT_PATH = "prompt/ai_character_prompt_[你的人设名字].txt" ``` -------------------------------- ### Modify TTS Voice ID - Python Source: https://github.com/lyihub/mad-professor-public/blob/main/README.md This Python code snippet shows how to modify the `voice_id` parameter within the `build_tts_stream_body` method of the `TTSManager` class in `TTS_manager.py` to change the voice used for TTS. ```Python body = json.dumps({ "model": "speech-02-turbo", "text": text, "stream": True, "voice_setting": { "voice_id": "将这个参数修改为你想要使用的voice id", "speed": 1, "vol": 1, "pitch": 0, "emotion": mapped_emotion }, "audio_setting": { "sample_rate": 32000, "bitrate": 128000, "format": "pcm", "channel": 1 } }) ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.