--- title: CSRC Car Manual RAG System emoji: 🚗 colorFrom: blue colorTo: purple sdk: gradio sdk_version: 6.0.0 app_file: app.py pinned: false license: mit --- # CSRC Car Manual RAG System An intelligent RAG (Retrieval-Augmented Generation) system for querying car manual documents using OpenAI and vector stores. ## 🚀 Features - **RAG-based Q&A**: Ask questions about car manual content - **Vector Store**: Fast and accurate document retrieval - **Knowledge Graph**: Visualize document relationships - **Personalized Learning**: Adaptive learning paths (optional) - **Scenario Contextualization**: Context-aware responses (optional) ## 📋 Setup Instructions ### 1. Clone or Upload to Hugging Face Spaces - **Option A**: Create a new Space on Hugging Face and upload files - **Option B**: Connect your GitHub repository to Spaces ### 2. Set Environment Variables (Secrets) Go to **Settings > Secrets** in your Space and add: ``` OPENAI_API_KEY=your-openai-api-key-here ``` ⚠️ **Important**: Never commit API keys to the repository. Always use Spaces Secrets. ### 3. Upload PDF Files Ensure your PDF files are in the `car_manual/` directory: ``` car_manual/ ├── Function of Active Distance Assist DISTRONIC.pdf ├── Function of Active Lane Change Assist.pdf ├── Function of Active Steering Assist.pdf └── Function of Active Stop-and-Go Assist.pdf ``` ### 4. Wait for Build Spaces will automatically: - Install dependencies from `requirements.txt` - Run `app.py` - Start the Gradio interface ## 📁 Project Structure ``` . ├── app.py # Hugging Face Spaces entry point ├── main.py # Local development entry point ├── requirements.txt # Python dependencies ├── src/ # Core modules ├── modules/ # Feature modules ├── car_manual/ # PDF files directory ├── config/ # Configuration files └── output/ # Output directory (auto-created) ``` ## 🔧 Configuration ### Required - **OPENAI_API_KEY**: Your OpenAI API key (set in Spaces Secrets) ### Optional - **PDF Files**: Place in `car_manual/` directory - **Vector Store**: Automatically created on first run ## 📖 Usage 1. Wait for the Space to build (check the logs) 2. Open the Gradio interface 3. Enter your question in the input field 4. Get answers with source citations ## 🐛 Troubleshooting ### Error: OPENAI_API_KEY not found - Go to Settings > Secrets - Add `OPENAI_API_KEY` with your actual API key - Restart the Space ### Error: No PDF files found - Ensure PDF files are in the `car_manual/` directory - Check file permissions - Verify file names (case-sensitive) ### Build Fails - Check the logs for error messages - Verify `requirements.txt` is correct - Ensure all Python dependencies are compatible ## 📝 Notes - Vector store is created automatically on first run - Vector store ID is saved in `config/vector_store_config.json` - First initialization may take time (uploading PDFs to OpenAI) ## 🔗 Links - [OpenAI API Keys](https://platform.openai.com/api-keys) - [Hugging Face Spaces Documentation](https://huggingface.co/docs/hub/spaces) ## 📄 License MIT License