File size: 2,854 Bytes
fe1e225 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 | # 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`.
|