Spaces:
Sleeping
Sleeping
MohammedNasser
commited on
Commit
โข
df2c275
1
Parent(s):
d1a5ff6
Update app.py
Browse files
app.py
CHANGED
@@ -18,9 +18,8 @@ from pdf2image import convert_from_path
|
|
18 |
from huggingface_hub import Repository, login
|
19 |
from huggingface_hub import hf_hub_download
|
20 |
from langchain.schema import Document
|
21 |
-
from PyPDF2 import PdfReader
|
22 |
-
from langdetect import detect
|
23 |
-
|
24 |
|
25 |
|
26 |
# Load environment variables
|
@@ -40,10 +39,6 @@ for folder in [UPLOAD_FOLDER, AUDIO_FOLDER]:
|
|
40 |
if not os.path.exists(folder):
|
41 |
os.makedirs(folder)
|
42 |
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
def load_pdf(file_path):
|
48 |
"""Load and preprocess Arabic text from a PDF file."""
|
49 |
|
@@ -61,7 +56,7 @@ def load_pdf(file_path):
|
|
61 |
documents.append(text)
|
62 |
except Exception as e:
|
63 |
print(f"Error processing page {pageNum}: {e}")
|
64 |
-
documents.append("")
|
65 |
|
66 |
return documents
|
67 |
|
@@ -276,11 +271,11 @@ with gr.Blocks(css=custom_css) as demo:
|
|
276 |
|
277 |
with gr.Row():
|
278 |
gr.Markdown("""
|
279 |
-
|
280 |
-
<ul style="list-style-type: disc;
|
281 |
-
<li style="color:
|
282 |
-
<li style="color:
|
283 |
-
<li style="color:
|
284 |
</ul>""", rtl=True)
|
285 |
pdf_input = gr.File(label="ุงุฎุชุฑ ู
ูู PDF")
|
286 |
with gr.Row():
|
|
|
18 |
from huggingface_hub import Repository, login
|
19 |
from huggingface_hub import hf_hub_download
|
20 |
from langchain.schema import Document
|
21 |
+
from PyPDF2 import PdfReader
|
22 |
+
from langdetect import detect
|
|
|
23 |
|
24 |
|
25 |
# Load environment variables
|
|
|
39 |
if not os.path.exists(folder):
|
40 |
os.makedirs(folder)
|
41 |
|
|
|
|
|
|
|
|
|
42 |
def load_pdf(file_path):
|
43 |
"""Load and preprocess Arabic text from a PDF file."""
|
44 |
|
|
|
56 |
documents.append(text)
|
57 |
except Exception as e:
|
58 |
print(f"Error processing page {pageNum}: {e}")
|
59 |
+
documents.append("")
|
60 |
|
61 |
return documents
|
62 |
|
|
|
271 |
|
272 |
with gr.Row():
|
273 |
gr.Markdown("""
|
274 |
+
|
275 |
+
<ul style="list-style-type: disc;">
|
276 |
+
<li style="color: #FF8343; font-size: 12px;">ุชุฃูุฏ ู
ู ุงุฎุชูุงุฑ ู
ูู PDF.</li>
|
277 |
+
<li style="color: #FF8343; font-size: 12px;">ุญุฌู
ุงูู
ูู ูุฌุจ ุฃู ูููู ุฃูู ู
ู 10 ู
ูุฌุงุจุงูุช.</li>
|
278 |
+
<li style="color: #FF8343; font-size: 12px;">ูุฌุจ ุฃู ูููู ุงูู
ุญุชูู ุจุงููุบุฉ ุงูุนุฑุจูุฉ.</li>
|
279 |
</ul>""", rtl=True)
|
280 |
pdf_input = gr.File(label="ุงุฎุชุฑ ู
ูู PDF")
|
281 |
with gr.Row():
|