# Bayan - Quick Start Guide ## ๐Ÿš€ Quick Start ### 1. Install Dependencies ```bash pip install -r requirements.txt ``` **Note:** If you have issues, install PyTorch separately: - CPU: `pip install torch --index-url https://download.pytorch.org/whl/cpu` - GPU: Visit https://pytorch.org/get-started/locally/ ### 2. Run the Application ```bash python run_app.py ``` ### 3. Open in Browser Navigate to: **http://localhost:5000** ## ๐Ÿ“ Project Structure ``` Bayan/ โ”œโ”€โ”€ src/ โ”‚ โ”œโ”€โ”€ app.py # Flask backend server โ”‚ โ”œโ”€โ”€ model_loader.py # Model loading and inference โ”‚ โ””โ”€โ”€ index.html # Web interface โ”œโ”€โ”€ models/ โ”‚ โ””โ”€โ”€ arabic_summarization_model/ โ”‚ โ””โ”€โ”€ content/drive/MyDrive/arabic_summarization_model/ โ”‚ โ”œโ”€โ”€ config.json โ”‚ โ”œโ”€โ”€ model.safetensors โ”‚ โ””โ”€โ”€ ... (other model files) โ”œโ”€โ”€ run_app.py # Application launcher โ”œโ”€โ”€ requirements.txt # Python dependencies โ””โ”€โ”€ README_SETUP.md # Detailed setup guide ``` ## ๐Ÿ”ง Features โœ… **Robust Error Handling** - Path validation for model files - Graceful fallbacks if model loading fails - Input validation and sanitization - Clear error messages โœ… **Security** - Input length limits (max 5000 characters) - CORS enabled for web interface - Safe model loading - Error logging โœ… **User Experience** - Loading indicators - Real-time feedback - Arabic language support - Responsive design ## ๐Ÿงช Testing ### Test API Health ```bash curl http://localhost:5000/api/health ``` ### Test Summarization ```bash curl -X POST http://localhost:5000/api/summarize \ -H "Content-Type: application/json" \ -d '{"text": "ู†ุต ุชุฌุฑูŠุจูŠ ู„ู„ุงุฎุชุจุงุฑ", "length": 2, "full_text": true}' ``` ## ๐Ÿ› Troubleshooting ### Model Not Found - Verify model path: `models/arabic_summarization_model/content/drive/MyDrive/arabic_summarization_model/` - Check that `config.json` exists - The app will search multiple possible locations automatically ### Dependencies Missing ```bash python check_dependencies.py pip install -r requirements.txt ``` ### Port Already in Use ```bash set PORT=5001 python run_app.py ``` ## ๐Ÿ“ API Documentation ### POST /api/summarize Summarize Arabic text. **Request:** ```json { "text": "ุงู„ู†ุต ุงู„ุนุฑุจูŠ...", "length": 2, // 1=short, 2=medium, 3=long "full_text": true } ``` **Response:** ```json { "status": "success", "summary": "ุงู„ู…ู„ุฎุต...", "original_length": 500, "summary_length": 150 } ``` ## ๐ŸŽฏ Next Steps 1. Install dependencies: `pip install -r requirements.txt` 2. Run the app: `python run_app.py` 3. Open browser: http://localhost:5000 4. Write Arabic text and click "ุชูˆู„ูŠุฏ ุงู„ู…ู„ุฎุต" For detailed information, see `README_SETUP.md`.