Spaces:
Sleeping
A newer version of the Gradio SDK is available:
5.5.0
title: Chat With Pdf
emoji: ๐ฌ
colorFrom: yellow
colorTo: purple
sdk: gradio
sdk_version: 4.44.0
app_file: app.py
pinned: false
license: apache-2.0
short_description: 'AI-powered system to interact with Arabic-language PDF doc '
Arabic PDF Chat Assistant ๐ค๐
Arabic PDF Chat Assistant is an AI-powered system that integrates Retrieval-Augmented Generation (RAG) to interact with Arabic-language PDF documents. Using Gemma, an advanced model from Google, the system allows users to upload PDF files and ask questions in Arabic. The assistant generates precise answers based on relevant document content, making it ideal for professionals, researchers, and students dealing with Arabic texts.
Table of Contents ๐
- Overview ๐
- Features โจ
- Model ๐ง
- Installation ๐ง
- Usage ๐
- Gradio Interface ๐ป
- License ๐
Overview ๐
The Arabic PDF Chat Assistant leverages RAG (Retrieval-Augmented Generation) technology to provide accurate answers by combining information retrieval and language generation capabilities. It is designed to analyze Arabic-language PDF documents and extract relevant content for natural language queries in Arabic.
The system is ideal for extracting key information from large, complex Arabic PDF documents and presenting it in a concise, professional manner.
Features โจ
- Arabic Language Support ๐: Fully supports queries and responses in Modern Standard Arabic (ุงููุตุญู).
- Retrieval-Augmented Generation (RAG) ๐: Enhances the assistant's ability to fetch information from the document and generate answers based on the retrieved content.
- PDF Querying ๐: Upload any Arabic PDF document and ask questions in Arabic. The assistant will retrieve relevant information from the document and generate a clear response.
- Gemma-powered Responses ๐ง : Utilizes Gemma from Google, an advanced model tailored for Arabic-language understanding and question-answering.
- Audio Responses ๐: The assistant can generate audio responses in Arabic using Text-to-Speech (TTS) technology.
- Interactive Gradio Interface ๐ป: A simple and intuitive web interface for chatting, uploading PDFs, and listening to audio responses.
Model ๐ง
The Arabic PDF Chat Assistant uses a RAG architecture powered by Gemma, a state-of-the-art language model from Google, specialized in Arabic question-answering. The model integrates information retrieval with language generation, allowing it to respond effectively based on the contents of PDF documents.
Model Details
- Base Model: Gemma (Googleโs advanced model for Arabic understanding).
- Architecture: Retrieval-Augmented Generation (RAG), which combines a retriever to find relevant parts of the document and a generator to create well-formed responses.
- Training Dataset: Fine-tuned using Arabic-language datasets for document comprehension and question-answering.
Installation ๐ง
Clone the repository
git clone https://github.com/your-repository/Arabic-PDF-Chat.git
cd Arabic-PDF-Chat
Install dependencies
Make sure to have Python installed, and then run:
pip install -r requirements.txt
API Keys (Optional)
If you're using any external services (e.g., Hugging Face Transformers, Google Gemma API), ensure you have the necessary API keys.
Usage ๐
Launch the application: Run the following command to launch the app in your browser:
python app.py
Upload PDF: Upload your Arabic-language PDF document through the Gradio interface.
Ask Questions: Enter your question in Arabic. The RAG system will retrieve relevant information from the PDF and generate a response based on the content.
Listen to Audio Responses (Optional): If enabled, you can listen to the assistantโs response via audio generated using Text-to-Speech (TTS).
Gradio Interface ๐ป
The user interface is built using Gradio, making it accessible and easy to use. Here's an example of the setup:
import gradio as gr
def chat(user_input):
# Chat function logic here
pass
with gr.Blocks() as demo:
with gr.Row():
gr.Image("logo.png")
with gr.Row():
pdf_input = gr.File(label="ุงุฎุชุฑ ู
ูู PDF")
with gr.Row():
chat_input = gr.Textbox(placeholder="ุฃุฏุฎู ุณุคุงูู ููุง ..")
with gr.Row():
submit_button_chat = gr.Button("ุฅุฑุณุงู")
submit_button_chat.click(chat, inputs=chat_input, outputs=chatbot)
demo.launch()
License ๐
This project is licensed under the MIT License. See the LICENSE
file for more details.