Spaces:
Sleeping
Sleeping
MohammedNasser
commited on
Commit
โข
3e58c9a
1
Parent(s):
b56c065
Update README.md
Browse files
README.md
CHANGED
@@ -4,57 +4,52 @@ emoji: ๐ฌ
|
|
4 |
colorFrom: yellow
|
5 |
colorTo: purple
|
6 |
sdk: gradio
|
7 |
-
sdk_version: 4.
|
8 |
app_file: app.py
|
9 |
pinned: false
|
10 |
license: apache-2.0
|
11 |
short_description: 'AI-powered system to interact with Arabic-language PDF doc '
|
12 |
---
|
13 |
|
|
|
14 |
|
15 |
-
|
16 |
|
17 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
|
19 |
-
##
|
20 |
-
-
|
21 |
-
- [Features](#features)
|
22 |
-
- [Model](#model)
|
23 |
-
- [Installation](#installation)
|
24 |
-
- [Usage](#usage)
|
25 |
-
- [Fine-Tuning](#fine-tuning)
|
26 |
-
- [Gradio Interface](#gradio-interface)
|
27 |
-
- [License](#license)
|
28 |
|
29 |
-
|
30 |
-
The **Arabic PDF Chat Assistant** is specialized for analyzing Arabic-language PDF documents. The assistant is fine-tuned to handle a variety of complex queries, ensuring that responses reflect the content accurately, with a focus on professionalism and clarity.
|
31 |
|
32 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
|
34 |
-
##
|
35 |
-
|
36 |
-
- **PDF Querying**: Upload any Arabic PDF document and ask natural language questions. The assistant will analyze and respond based on the content.
|
37 |
-
- **Fine-tuned Model**: The model is fine-tuned on Arabic question-answering datasets to provide high accuracy and relevance in responses.
|
38 |
-
- **Multimodal Outputs**: In addition to text-based responses, the assistant can generate audio responses in Arabic using text-to-speech (TTS) technology.
|
39 |
-
- **Interactive Gradio Interface**: Intuitive and easy-to-use interface, allowing users to chat, upload files, and listen to audio responses directly from their browser.
|
40 |
-
- **Customizable**: The system is built to be flexible, with room for expansion and improvements based on specific use cases.
|
41 |
-
|
42 |
-
## Model
|
43 |
-
The assistant uses a fine-tuned transformer-based model specialized in Arabic question-answering tasks. The model has been trained to:
|
44 |
-
- Understand Arabic syntax and semantics.
|
45 |
-
- Analyze and extract relevant information from PDF documents.
|
46 |
-
- Provide clear and concise answers in Arabic while avoiding informal or colloquial language.
|
47 |
|
48 |
### Model Details
|
49 |
-
- **Base Model**:
|
50 |
-
- **
|
51 |
-
- **Training Dataset**:
|
52 |
|
53 |
-
## Installation
|
54 |
|
55 |
### Clone the repository
|
56 |
```bash
|
57 |
-
git clone https://
|
58 |
cd Arabic-PDF-Chat
|
59 |
```
|
60 |
|
@@ -65,45 +60,28 @@ pip install -r requirements.txt
|
|
65 |
```
|
66 |
|
67 |
### API Keys (Optional)
|
68 |
-
If you're using any external services (e.g., Hugging Face Transformers,
|
69 |
|
70 |
-
## Usage
|
71 |
|
72 |
-
1. **Launch the application
|
73 |
Run the following command to launch the app in your browser:
|
74 |
```bash
|
75 |
python app.py
|
76 |
```
|
77 |
|
78 |
-
2. **Upload PDF
|
79 |
Upload your Arabic-language PDF document through the Gradio interface.
|
80 |
|
81 |
-
3. **Ask Questions
|
82 |
-
|
83 |
-
|
84 |
-
4. **Listen to Audio Responses (Optional):**
|
85 |
-
If enabled, you can listen to the assistant's response via audio generated using Text-to-Speech (TTS).
|
86 |
-
|
87 |
-
## Fine-Tuning
|
88 |
-
|
89 |
-
The model is fine-tuned on a set of Arabic-language question-answering datasets. To fine-tune or modify the current model, follow these steps:
|
90 |
|
91 |
-
|
92 |
-
|
93 |
-
- Use a dataset that consists of Arabic-language documents paired with question-answer pairs.
|
94 |
-
```
|
95 |
-
|
96 |
-
## Gradio Interface
|
97 |
|
98 |
-
|
99 |
|
100 |
-
|
101 |
-
- **PDF Upload**: A file uploader for Arabic PDFs.
|
102 |
-
- **Chatbox**: A two-part chat component where users enter questions, and the assistant responds based on the documentโs content.
|
103 |
-
- **Audio Response**: A feature that plays the response using TTS in Arabic.
|
104 |
-
- **Clear Chat**: A button to reset the chat history.
|
105 |
-
|
106 |
-
Hereโs a simplified look at the Gradio UI:
|
107 |
|
108 |
```python
|
109 |
import gradio as gr
|
@@ -114,7 +92,7 @@ def chat(user_input):
|
|
114 |
|
115 |
with gr.Blocks() as demo:
|
116 |
with gr.Row():
|
117 |
-
gr.Image("logo.png") # Display company logo
|
118 |
with gr.Row():
|
119 |
pdf_input = gr.File(label="ุงุฎุชุฑ ู
ูู PDF")
|
120 |
with gr.Row():
|
@@ -127,7 +105,5 @@ with gr.Blocks() as demo:
|
|
127 |
demo.launch()
|
128 |
```
|
129 |
|
130 |
-
## License
|
131 |
This project is licensed under the MIT License. See the `LICENSE` file for more details.
|
132 |
-
|
133 |
-
---
|
|
|
4 |
colorFrom: yellow
|
5 |
colorTo: purple
|
6 |
sdk: gradio
|
7 |
+
sdk_version: 4.44.0
|
8 |
app_file: app.py
|
9 |
pinned: false
|
10 |
license: apache-2.0
|
11 |
short_description: 'AI-powered system to interact with Arabic-language PDF doc '
|
12 |
---
|
13 |
|
14 |
+
# **Arabic PDF Chat Assistant ๐ค๐**
|
15 |
|
16 |
+
**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.
|
17 |
|
18 |
+
## Table of Contents ๐
|
19 |
+
- [Overview](#overview) ๐
|
20 |
+
- [Features](#features) โจ
|
21 |
+
- [Model](#model) ๐ง
|
22 |
+
- [Installation](#installation) ๐ง
|
23 |
+
- [Usage](#usage) ๐
|
24 |
+
- [Gradio Interface](#gradio-interface) ๐ป
|
25 |
+
- [License](#license) ๐
|
26 |
|
27 |
+
## Overview ๐
|
28 |
+
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
|
30 |
+
The system is ideal for extracting key information from large, complex Arabic PDF documents and presenting it in a concise, professional manner.
|
|
|
31 |
|
32 |
+
## Features โจ
|
33 |
+
- **Arabic Language Support** ๐: Fully supports queries and responses in Modern Standard Arabic (ุงููุตุญู).
|
34 |
+
- **Retrieval-Augmented Generation (RAG)** ๐: Enhances the assistant's ability to fetch information from the document and generate answers based on the retrieved content.
|
35 |
+
- **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.
|
36 |
+
- **Gemma-powered Responses** ๐ง : Utilizes **Gemma** from Google, an advanced model tailored for Arabic-language understanding and question-answering.
|
37 |
+
- **Audio Responses** ๐: The assistant can generate audio responses in Arabic using Text-to-Speech (TTS) technology.
|
38 |
+
- **Interactive Gradio Interface** ๐ป: A simple and intuitive web interface for chatting, uploading PDFs, and listening to audio responses.
|
39 |
|
40 |
+
## Model ๐ง
|
41 |
+
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
42 |
|
43 |
### Model Details
|
44 |
+
- **Base Model**: Gemma (Googleโs advanced model for Arabic understanding).
|
45 |
+
- **Architecture**: **Retrieval-Augmented Generation (RAG)**, which combines a retriever to find relevant parts of the document and a generator to create well-formed responses.
|
46 |
+
- **Training Dataset**: Fine-tuned using Arabic-language datasets for document comprehension and question-answering.
|
47 |
|
48 |
+
## Installation ๐ง
|
49 |
|
50 |
### Clone the repository
|
51 |
```bash
|
52 |
+
git clone https://github.com/your-repository/Arabic-PDF-Chat.git
|
53 |
cd Arabic-PDF-Chat
|
54 |
```
|
55 |
|
|
|
60 |
```
|
61 |
|
62 |
### API Keys (Optional)
|
63 |
+
If you're using any external services (e.g., Hugging Face Transformers, Google Gemma API), ensure you have the necessary API keys.
|
64 |
|
65 |
+
## Usage ๐
|
66 |
|
67 |
+
1. **Launch the application**:
|
68 |
Run the following command to launch the app in your browser:
|
69 |
```bash
|
70 |
python app.py
|
71 |
```
|
72 |
|
73 |
+
2. **Upload PDF**:
|
74 |
Upload your Arabic-language PDF document through the Gradio interface.
|
75 |
|
76 |
+
3. **Ask Questions**:
|
77 |
+
Enter your question in Arabic. The RAG system will retrieve relevant information from the PDF and generate a response based on the content.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
78 |
|
79 |
+
4. **Listen to Audio Responses (Optional)**:
|
80 |
+
If enabled, you can listen to the assistantโs response via audio generated using Text-to-Speech (TTS).
|
|
|
|
|
|
|
|
|
81 |
|
82 |
+
## Gradio Interface ๐ป
|
83 |
|
84 |
+
The user interface is built using **Gradio**, making it accessible and easy to use. Here's an example of the setup:
|
|
|
|
|
|
|
|
|
|
|
|
|
85 |
|
86 |
```python
|
87 |
import gradio as gr
|
|
|
92 |
|
93 |
with gr.Blocks() as demo:
|
94 |
with gr.Row():
|
95 |
+
gr.Image("logo.png", label="Company Logo") # Display company logo
|
96 |
with gr.Row():
|
97 |
pdf_input = gr.File(label="ุงุฎุชุฑ ู
ูู PDF")
|
98 |
with gr.Row():
|
|
|
105 |
demo.launch()
|
106 |
```
|
107 |
|
108 |
+
## License ๐
|
109 |
This project is licensed under the MIT License. See the `LICENSE` file for more details.
|
|
|
|