A bilingual Legal AI Assistant specialized in Omani legal documentation, offering advanced document processing capabilities across Arabic and English languages.
- Document Q&A: Ask questions about legal documents in English or Arabic
- Article Summarization: Get concise summaries of specific legal articles
- Law Comparison: Compare different laws to understand similarities and differences
- Case Analysis: Submit a case description and get legal analysis based on relevant laws
- Document Creation: Generate legal documents based on user specifications
- Voice Input: Upload voice recordings for hands-free interaction
- AI-Powered Text Improvement: Enhanced readability for legal citations
- PDF Generation: Export results as professional PDF documents
- Bilingual Support: Full support for both English and Arabic
- Python 3.9 or higher
- OpenAI API key
- (Optional) Anthropic API key for alternative model support
-
Fork this Replit project
-
Set up your environment secrets:
- Go to the "Secrets" tab in your Replit project
- Add your
OPENAI_API_KEY
as a new secret - (Optional) Add
ANTHROPIC_API_KEY
if you want to use Claude models
-
Run the application:
- Click the "Run" button at the top
- The application will start at the URL shown in the console
-
Clone the repository:
git clone https://github.com/alanqoudif/Omani-Legal-AI-Assistant.git cd omani-legal-ai-assistant
-
Install the required packages:
pip install -r requirements.txt
Required packages include:
- streamlit
- openai
- anthropic (optional)
- langchain
- langchain-community
- numpy
- faiss-cpu
- google-generativeai
- pymupdf
- reportlab
- pydub
- trafilatura
- arabic-reshaper
- python-bidi
- whisper
- tensorflow
- tensorflow-hub
- sentence-transformers
-
Set up environment variables:
# On Linux/Mac export OPENAI_API_KEY="your-openai-api-key" # On Windows set OPENAI_API_KEY=your-openai-api-key
-
Run the application:
streamlit run app.py --server.port 5000
-
Process Legal Documents:
- Click on "Process Legal Documents" to upload PDF files of legal documents
- The system will process and index the documents for searching
-
Document Q&A:
- Ask questions about the legal documents
- Use voice input by clicking the microphone button or uploading an audio file
- View responses with improved text formatting
-
Article Summarizer:
- Select a law and article number
- Get a concise summary of the article
-
Law Comparison:
- Select two different laws
- View a detailed comparison highlighting similarities and differences
-
Case Analyzer:
- Describe a legal case
- Receive analysis based on relevant laws
- Download a PDF report
-
Document Creator:
- Specify details for a legal document
- Get a professionally formatted document
- Toggle between English and Arabic using the language selector
- All components support both languages
- Arabic text is properly handled with bidirectional support
This application uses OpenAI's GPT models for text processing. You'll need to provide your own API key:
- Get an API key from OpenAI
- Add it to your environment variables as
OPENAI_API_KEY
For Claude model support:
- Get an API key from Anthropic
- Add it to your environment variables as
ANTHROPIC_API_KEY
- Application not starting: Ensure all dependencies are installed and API keys are set up
- PDF processing errors: Make sure PDFs are not encrypted and are in a readable format
- Arabic text display issues: Verify that arabic-reshaper and python-bidi are installed correctly
- Voice input not working: Check that audio files are in supported formats (WAV, MP3, OGG)
This project is licensed under the MIT License - see the LICENSE file for details.
- This project uses various AI models and libraries for natural language processing
- Special thanks to the Streamlit, Langchain, and OpenAI communities for their tools and documentation