Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
@@ -3,6 +3,7 @@ import whisper
|
|
3 |
import os
|
4 |
import asyncio
|
5 |
import edge_tts
|
|
|
6 |
from transformers import pipeline
|
7 |
from deep_translator import GoogleTranslator
|
8 |
from docx import Document
|
@@ -59,7 +60,6 @@ VOICE_MAPPINGS = {
|
|
59 |
# تحديد اللغات RTL
|
60 |
RTL_LANGUAGES = ['ar']
|
61 |
|
62 |
-
|
63 |
async def generate_speech(text, lang, voice_gender='male', speed=1.0):
|
64 |
"""توليد الصوت باستخدام edge-tts مع خيارات إضافية"""
|
65 |
try:
|
@@ -96,9 +96,6 @@ async def generate_speech(text, lang, voice_gender='male', speed=1.0):
|
|
96 |
logger.error(f"خطأ في توليد الصوت: {str(e)}")
|
97 |
return None
|
98 |
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
def text_to_speech(text, lang, voice_gender='male', speed=1.0, progress=gr.Progress()):
|
103 |
"""واجهة لتحويل النص إلى صوت مع خيارات إضافية"""
|
104 |
if not text:
|
@@ -156,7 +153,6 @@ def text_to_speech(text, lang, voice_gender='male', speed=1.0, progress=gr.Progr
|
|
156 |
logger.error(f"خطأ في تحويل النص إلى صوت: {str(e)}")
|
157 |
return None
|
158 |
|
159 |
-
|
160 |
def create_document(original_text, translated_text, source_lang, target_lang, progress=gr.Progress()):
|
161 |
"""إنشاء ملف Word يحتوي على النص الأصلي والترجمة"""
|
162 |
try:
|
|
|
3 |
import os
|
4 |
import asyncio
|
5 |
import edge_tts
|
6 |
+
import torch
|
7 |
from transformers import pipeline
|
8 |
from deep_translator import GoogleTranslator
|
9 |
from docx import Document
|
|
|
60 |
# تحديد اللغات RTL
|
61 |
RTL_LANGUAGES = ['ar']
|
62 |
|
|
|
63 |
async def generate_speech(text, lang, voice_gender='male', speed=1.0):
|
64 |
"""توليد الصوت باستخدام edge-tts مع خيارات إضافية"""
|
65 |
try:
|
|
|
96 |
logger.error(f"خطأ في توليد الصوت: {str(e)}")
|
97 |
return None
|
98 |
|
|
|
|
|
|
|
99 |
def text_to_speech(text, lang, voice_gender='male', speed=1.0, progress=gr.Progress()):
|
100 |
"""واجهة لتحويل النص إلى صوت مع خيارات إضافية"""
|
101 |
if not text:
|
|
|
153 |
logger.error(f"خطأ في تحويل النص إلى صوت: {str(e)}")
|
154 |
return None
|
155 |
|
|
|
156 |
def create_document(original_text, translated_text, source_lang, target_lang, progress=gr.Progress()):
|
157 |
"""إنشاء ملف Word يحتوي على النص الأصلي والترجمة"""
|
158 |
try:
|