Spaces:
Sleeping
Sleeping
Upload 5 files
Browse files- .gitattributes +35 -35
- .gitignore +4 -0
- app.py +42 -34
- readme.md +107 -0
- run_app.command +2 -0
.gitattributes
CHANGED
@@ -1,35 +1,35 @@
|
|
1 |
-
*.7z filter=lfs diff=lfs merge=lfs -text
|
2 |
-
*.arrow filter=lfs diff=lfs merge=lfs -text
|
3 |
-
*.bin filter=lfs diff=lfs merge=lfs -text
|
4 |
-
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
5 |
-
*.ckpt filter=lfs diff=lfs merge=lfs -text
|
6 |
-
*.ftz filter=lfs diff=lfs merge=lfs -text
|
7 |
-
*.gz filter=lfs diff=lfs merge=lfs -text
|
8 |
-
*.h5 filter=lfs diff=lfs merge=lfs -text
|
9 |
-
*.joblib filter=lfs diff=lfs merge=lfs -text
|
10 |
-
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
11 |
-
*.mlmodel filter=lfs diff=lfs merge=lfs -text
|
12 |
-
*.model filter=lfs diff=lfs merge=lfs -text
|
13 |
-
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
14 |
-
*.npy filter=lfs diff=lfs merge=lfs -text
|
15 |
-
*.npz filter=lfs diff=lfs merge=lfs -text
|
16 |
-
*.onnx filter=lfs diff=lfs merge=lfs -text
|
17 |
-
*.ot filter=lfs diff=lfs merge=lfs -text
|
18 |
-
*.parquet filter=lfs diff=lfs merge=lfs -text
|
19 |
-
*.pb filter=lfs diff=lfs merge=lfs -text
|
20 |
-
*.pickle filter=lfs diff=lfs merge=lfs -text
|
21 |
-
*.pkl filter=lfs diff=lfs merge=lfs -text
|
22 |
-
*.pt filter=lfs diff=lfs merge=lfs -text
|
23 |
-
*.pth filter=lfs diff=lfs merge=lfs -text
|
24 |
-
*.rar filter=lfs diff=lfs merge=lfs -text
|
25 |
-
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
26 |
-
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
27 |
-
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
28 |
-
*.tar filter=lfs diff=lfs merge=lfs -text
|
29 |
-
*.tflite filter=lfs diff=lfs merge=lfs -text
|
30 |
-
*.tgz filter=lfs diff=lfs merge=lfs -text
|
31 |
-
*.wasm filter=lfs diff=lfs merge=lfs -text
|
32 |
-
*.xz filter=lfs diff=lfs merge=lfs -text
|
33 |
-
*.zip filter=lfs diff=lfs merge=lfs -text
|
34 |
-
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
-
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
1 |
+
*.7z filter=lfs diff=lfs merge=lfs -text
|
2 |
+
*.arrow filter=lfs diff=lfs merge=lfs -text
|
3 |
+
*.bin filter=lfs diff=lfs merge=lfs -text
|
4 |
+
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
5 |
+
*.ckpt filter=lfs diff=lfs merge=lfs -text
|
6 |
+
*.ftz filter=lfs diff=lfs merge=lfs -text
|
7 |
+
*.gz filter=lfs diff=lfs merge=lfs -text
|
8 |
+
*.h5 filter=lfs diff=lfs merge=lfs -text
|
9 |
+
*.joblib filter=lfs diff=lfs merge=lfs -text
|
10 |
+
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
11 |
+
*.mlmodel filter=lfs diff=lfs merge=lfs -text
|
12 |
+
*.model filter=lfs diff=lfs merge=lfs -text
|
13 |
+
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
14 |
+
*.npy filter=lfs diff=lfs merge=lfs -text
|
15 |
+
*.npz filter=lfs diff=lfs merge=lfs -text
|
16 |
+
*.onnx filter=lfs diff=lfs merge=lfs -text
|
17 |
+
*.ot filter=lfs diff=lfs merge=lfs -text
|
18 |
+
*.parquet filter=lfs diff=lfs merge=lfs -text
|
19 |
+
*.pb filter=lfs diff=lfs merge=lfs -text
|
20 |
+
*.pickle filter=lfs diff=lfs merge=lfs -text
|
21 |
+
*.pkl filter=lfs diff=lfs merge=lfs -text
|
22 |
+
*.pt filter=lfs diff=lfs merge=lfs -text
|
23 |
+
*.pth filter=lfs diff=lfs merge=lfs -text
|
24 |
+
*.rar filter=lfs diff=lfs merge=lfs -text
|
25 |
+
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
26 |
+
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
27 |
+
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
28 |
+
*.tar filter=lfs diff=lfs merge=lfs -text
|
29 |
+
*.tflite filter=lfs diff=lfs merge=lfs -text
|
30 |
+
*.tgz filter=lfs diff=lfs merge=lfs -text
|
31 |
+
*.wasm filter=lfs diff=lfs merge=lfs -text
|
32 |
+
*.xz filter=lfs diff=lfs merge=lfs -text
|
33 |
+
*.zip filter=lfs diff=lfs merge=lfs -text
|
34 |
+
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
+
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
.gitignore
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
*.pyc
|
2 |
+
__pycache__/
|
3 |
+
.DS_Store
|
4 |
+
.env
|
app.py
CHANGED
@@ -1,39 +1,47 @@
|
|
1 |
import gradio as gr
|
2 |
-
|
3 |
-
from components.search_tab import create_search_tab
|
4 |
-
from components.statistics_tab import create_statistics_tab
|
5 |
-
from components.surah_tab import create_surah_tab
|
6 |
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
surah_names_list = get_surah_names_list(surah_names)
|
18 |
|
19 |
-
#
|
20 |
-
|
21 |
-
gr.Markdown("""
|
22 |
-
# Quran Explorer
|
23 |
-
Welcome to the Quran Explorer application. This tool provides multiple ways to explore
|
24 |
-
and understand the Holy Quran through its English translation. Use the tabs below to:
|
25 |
-
- Search for specific words or phrases
|
26 |
-
- View statistical insights and visualizations
|
27 |
-
- Read complete Surahs with word cloud visualizations
|
28 |
-
""")
|
29 |
-
|
30 |
-
# Create tabs
|
31 |
-
search_tab = create_search_tab(quran_data)
|
32 |
-
statistics_tab = create_statistics_tab(quran_data)
|
33 |
-
surah_tab = create_surah_tab(quran_data, surah_names_list)
|
34 |
|
35 |
-
|
36 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
37 |
|
38 |
-
|
39 |
-
main()
|
|
|
1 |
import gradio as gr
|
2 |
+
import os
|
|
|
|
|
|
|
3 |
|
4 |
+
# ...existing code...
|
5 |
+
|
6 |
+
def load_surah(surah_name, surah_number):
|
7 |
+
# Load the verses from a file or a predefined dictionary
|
8 |
+
# For simplicity, let's assume we have a dictionary `surah_verses`
|
9 |
+
surah_verses = {
|
10 |
+
"Al-Kahf": ["Verse 1", "Verse 2", "Verse 3", "..."]
|
11 |
+
# Add other surahs here
|
12 |
+
}
|
13 |
+
verses = surah_verses.get(surah_name, [])
|
|
|
14 |
|
15 |
+
# Load the word cloud image path
|
16 |
+
word_cloud_path = f"plots/{surah_name} word cloud.png"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
|
18 |
+
return verses, word_cloud_path
|
19 |
+
|
20 |
+
def display_surah(surah_name, surah_number):
|
21 |
+
verses, word_cloud_path = load_surah(surah_name, surah_number)
|
22 |
+
verses_text = "\n".join(verses)
|
23 |
+
return verses_text, word_cloud_path
|
24 |
+
|
25 |
+
# Create a list of surah names and numbers
|
26 |
+
surah_names = ["Al-Kahf", "Another Surah"] # Add all surah names here
|
27 |
+
surah_numbers = list(range(1, 115)) # Surah numbers from 1 to 114
|
28 |
+
|
29 |
+
with gr.Blocks() as demo:
|
30 |
+
with gr.Tabs():
|
31 |
+
with gr.TabItem("Word Cloud"):
|
32 |
+
# ...existing code for word cloud tab...
|
33 |
+
pass
|
34 |
+
|
35 |
+
with gr.TabItem("Surah Viewer"):
|
36 |
+
surah_name = gr.Dropdown(label="Surah Name", choices=surah_names)
|
37 |
+
surah_number = gr.Dropdown(label="Surah Number", choices=surah_numbers)
|
38 |
+
verses_output = gr.Textbox(label="Verses", lines=20)
|
39 |
+
word_cloud_output = gr.Image(label="Word Cloud")
|
40 |
+
|
41 |
+
gr.Button("Load Surah").click(
|
42 |
+
display_surah,
|
43 |
+
inputs=[surah_name, surah_number],
|
44 |
+
outputs=[verses_output, word_cloud_output]
|
45 |
+
)
|
46 |
|
47 |
+
demo.launch()
|
|
readme.md
ADDED
@@ -0,0 +1,107 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Al-Quran Repository
|
2 |
+
A user-friendly application for exploring the Holy Quran through its English translation, built with Python and Gradio.
|
3 |
+
|
4 |
+
|
5 |
+
## Features
|
6 |
+
|
7 |
+
- **Keyword Search**: Search for specific words or phrases across the entire Quran
|
8 |
+
- **Statistical Analysis**: View visualizations and statistics about Quran's structure
|
9 |
+
- **Surah Explorer**: Read complete Surahs with word cloud visualizations
|
10 |
+
|
11 |
+
### 1. Quranic Analysis (Jupyter Notebooks)
|
12 |
+
A collection of interactive notebooks providing statistical insights about the Quran:
|
13 |
+
- Word frequency distributions
|
14 |
+
- Verse length analysis
|
15 |
+
- Surah-wise statistics
|
16 |
+
- Pattern analysis
|
17 |
+
- Visualization of Quranic data
|
18 |
+

|
19 |
+

|
20 |
+
|
21 |
+
### 2. Verse Search Interface (Gradio App)
|
22 |
+
An intuitive web interface for searching Quranic verses:
|
23 |
+
- Search by keywords
|
24 |
+
- Find specific verses and their translations
|
25 |
+
- Get verse context and metadata
|
26 |
+
- User-friendly interface powered by Gradio
|
27 |
+
<img width="2056" alt="Screenshot 2025-03-08 at 3 53 52β―AM" src="https://github.com/user-attachments/assets/7903305f-5b01-4866-8541-ef6a73b887e8" />
|
28 |
+
|
29 |
+
<img width="2056" alt="Screenshot 2025-03-08 at 3 54 09β―AM" src="https://github.com/user-attachments/assets/ea1732e7-656b-43fe-9eb5-59ed98b3a3ca" />
|
30 |
+
|
31 |
+
|
32 |
+
|
33 |
+
## Project Structure
|
34 |
+
|
35 |
+
```
|
36 |
+
.
|
37 |
+
βββ datasets/ # Dataset files
|
38 |
+
β βββ en.yusufali.csv # English translation
|
39 |
+
β βββ surah_names_english.csv
|
40 |
+
βββ src/ # Source code
|
41 |
+
β βββ components/ # Modular components
|
42 |
+
β β βββ search_tab.py # Search functionality
|
43 |
+
β β βββ statistics_tab.py # Statistics and visualizations
|
44 |
+
β β βββ surah_tab.py # Surah display
|
45 |
+
β β βββ utils.py # Shared utilities
|
46 |
+
β βββ styles/ # Styling
|
47 |
+
β β βββ styles.css # CSS styles
|
48 |
+
β βββ gradio_app.py # Main application
|
49 |
+
βββ word_cloud/ # Word cloud images for each Surah
|
50 |
+
```
|
51 |
+
|
52 |
+
## Dependencies
|
53 |
+
|
54 |
+
- Python 3.7+
|
55 |
+
- gradio
|
56 |
+
- pandas
|
57 |
+
- matplotlib
|
58 |
+
- seaborn
|
59 |
+
- re
|
60 |
+
|
61 |
+
## Installation
|
62 |
+
|
63 |
+
1. Clone the repository
|
64 |
+
2. Install dependencies:
|
65 |
+
```bash
|
66 |
+
pip install gradio pandas matplotlib seaborn
|
67 |
+
```
|
68 |
+
|
69 |
+
## Running the Application
|
70 |
+
|
71 |
+
Navigate to the project directory and run:
|
72 |
+
|
73 |
+
```bash
|
74 |
+
python src/gradio_app.py
|
75 |
+
```
|
76 |
+
|
77 |
+
The application will be available at `http://localhost:7860` by default.
|
78 |
+
|
79 |
+
## Contributing
|
80 |
+
|
81 |
+
### Adding New Features
|
82 |
+
|
83 |
+
1. Create new components in the `src/components/` directory
|
84 |
+
2. Update styles in `src/styles/styles.css`
|
85 |
+
3. Import and integrate components in `src/gradio_app.py`
|
86 |
+
|
87 |
+
### Code Structure
|
88 |
+
|
89 |
+
- Each tab's functionality is contained in a separate module
|
90 |
+
- Shared utilities are in `utils.py`
|
91 |
+
- CSS styling is centralized in `styles.css`
|
92 |
+
|
93 |
+
### Guidelines
|
94 |
+
|
95 |
+
- Follow the existing code structure
|
96 |
+
- Add appropriate documentation
|
97 |
+
- Test new features thoroughly
|
98 |
+
- Update README.md when adding new features
|
99 |
+
|
100 |
+
## License
|
101 |
+
|
102 |
+
Open source under MIT License
|
103 |
+
|
104 |
+
## Credits
|
105 |
+
|
106 |
+
- Quran translation: Yusuf Ali
|
107 |
+
- Application development: [email protected]
|
run_app.command
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
#!/bin/bash
|
2 |
+
/Users/salam9/.pyenv/versions/3.12.1/bin/python /Users/salam9/Desktop/quran/src/gradio_app.py
|