--- title: Arabic Story Content Moderator emoji: 📝 colorFrom: blue colorTo: green sdk: docker sdk_version: 3.11.0 app_file: app.py pinned: false --- # Arabic Story Content Moderator An AI-powered content moderation service for Arabic short stories that checks for cultural violations and inappropriate content using the Deepseek API. ## 🌟 Features - **Cultural Sensitivity**: Checks stories against Arabic and Islamic cultural norms - **Content Safety**: Detects inappropriate sexual content, excessive violence, and profanity - **Real-time Moderation**: Fast API response for instant content validation - **Batch Processing**: Support for moderating multiple stories at once - **Arabic Language Support**: Specialized for Arabic text processing ## 🚀 API Endpoints ### POST `/moderate` Moderate a single Arabic story. **Request:** ```json { "story_content": "نص القصة العربية هنا" } ``` **Response:** ```json { "approved": true, "response": "true", "timestamp": "2024-01-15T10:30:00" } ``` ### POST `/moderate/batch` Moderate multiple stories at once. **Request:** ```json { "stories": ["قصة أولى", "قصة ثانية", "قصة ثالثة"] } ``` ### GET `/health` Check service health status. ## 📋 Response Format The API returns consistent responses: - `approved`: Boolean indicating if content is approved - `response`: String value "true" (approved) or "no" (rejected) - `timestamp`: ISO timestamp of the moderation - `reason`: Description if content is rejected ## 🔧 Moderation Criteria ### 1. Cultural and Religious Content - No mockery of Islamic religion or Arabic traditions - Respect for religious and social symbols - Adherence to Islamic values ### 2. Sexual Content and Violence - No explicit sexual content or suggestive material - No excessive or graphic violence - No profanity or inappropriate language ### 3. Sensitive Political Content - No sectarian or ethnic incitement - Avoidance of controversial political topics ### 4. Social Values - Respect for family and community values - No promotion of socially destructive behaviors ## 🛠️ Integration Example ### cURL Example ```bash curl -X POST "https://your-huggingface-space-url/moderate" \ -H "Content-Type: application/json" \ -d '{"story_content": "قصة قصيرة عن الصداقة والوفاء"}' ``` ### Python Example ```python import requests url = "https://your-huggingface-space-url/moderate" data = { "story_content": "نص القصة العربية" } response = requests.post(url, json=data) result = response.json() if result["approved"]: print("Story approved for posting") else: print("Story violates community guidelines") ``` ## 📝 Setup Instructions ### Environment Variables Set your Deepseek API key as an environment variable: ``` DEEPSEEK_API_KEY=your_deepseek_api_key_here ``` ### Local Testing ```bash pip install -r requirements.txt export DEEPSEEK_API_KEY=your_api_key python app.py ``` ## 🔒 Privacy and Security - Stories are processed in real-time and not stored - API communications are encrypted - No personal data is retained - Compliant with data protection standards ## 📈 Performance - Average response time: < 2 seconds - Supports concurrent requests - Optimized for Arabic text processing - Scalable architecture ## 🤝 Integration with .NET Backend This service is designed to integrate seamlessly with your .NET story posting API. When a user attempts to post a story, send it to this moderation service first. ## 📞 Support For technical support or questions about the moderation criteria, please refer to the documentation or contact the development team. --- **Made with ❤️ for the Arabic literary community**