Update app.py
Browse files
app.py
CHANGED
|
@@ -7,67 +7,77 @@ import uuid
|
|
| 7 |
from huggingface_hub import HfApi
|
| 8 |
from concurrent.futures import ThreadPoolExecutor
|
| 9 |
|
| 10 |
-
# --- الإعدادات ---
|
| 11 |
HF_TOKEN = os.getenv("HF_TOKEN")
|
| 12 |
REPO_ID = "Alide21/speech_quran"
|
| 13 |
api = HfApi()
|
| 14 |
|
| 15 |
SURAH_NAMES = ["الفاتحة", "البقرة", "آل عمران", "النساء", "المائدة", "الأنعام", "الأعراف", "الأنفال", "التوبة", "يونس", "هود", "يوسف", "الرعد", "إبراهيم", "الحجر", "النحل", "الإسراء", "الكهف", "مريم", "طه", "الأنبياء", "الحج", "المؤمنون", "النور", "الفرقان", "الشعراء", "النمل", "القصص", "العنكبوت", "الروم", "لقمان", "السجدة", "الأحزاب", "سبأ", "فاطر", "يس", "الصافات", "ص", "الزمر", "غافر", "فصلت", "الشورى", "الزخرف", "الدخان", "الجاثية", "الأحقاف", "محمد", "الفتح", "الحجرات", "ق", "الذاريات", "الطور", "النجم", "القمر", "الرحمن", "الواقعة", "الحديد", "المجادلة", "الحشر", "الممتحنة", "الصف", "الجمعة", "المنافقون", "التغابن", "الطلاق", "التحريم", "الملك", "القلم", "الحاقة", "المعارج", "نوح", "الجن", "المزمل", "المدثر", "القيامة", "الإنسان", "المرسلات", "النبأ", "النازعات", "عبس", "التكوير", "الانفطار", "المطففين", "الانشقاق", "البروج", "الطارق", "الأعلى", "الغاشية", "الفجر", "البلد", "الشمس", "الليل", "الضحى", "الشرح", "التين", "العلق", "القدر", "البينة", "الزلزلة", "العاديات", "القارعة", "التكاثر", "العصر", "الهمزة", "الفيل", "قريش", "الماعون", "الكوثر", "الكافرون", "النصر", "المسد", "الإخلاص", "الفلق", "الناس"]
|
| 16 |
|
| 17 |
-
# --- التنسيق البصري ---
|
| 18 |
custom_css = """
|
| 19 |
@import url('https://fonts.googleapis.com/css2?family=Amiri:wght@400;700&family=Reem+Kufi:wght@400;700&display=swap');
|
|
|
|
| 20 |
:root { --gold: #D4AF37; --dark-green: #064635; }
|
| 21 |
-
body { direction: rtl; background-color: #f9f9f9; }
|
| 22 |
|
|
|
|
|
|
|
|
|
|
| 23 |
.hero-header {
|
| 24 |
-
background: linear-gradient(
|
| 25 |
-
|
| 26 |
-
|
|
|
|
|
|
|
|
|
|
| 27 |
text-align: center;
|
| 28 |
-
color: white;
|
| 29 |
-
box-shadow: 0
|
| 30 |
}
|
| 31 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 32 |
.instruction-box {
|
| 33 |
background: #fff9e6;
|
| 34 |
-
border-right: 5px solid
|
| 35 |
-
padding:
|
| 36 |
-
border-radius:
|
| 37 |
-
margin:
|
| 38 |
-
font-size:
|
| 39 |
-
|
| 40 |
}
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
|
|
|
|
|
|
| 48 |
}
|
|
|
|
| 49 |
.ayah-text {
|
| 50 |
font-family: 'Amiri', serif !important;
|
| 51 |
-
font-size: 2.
|
| 52 |
color: var(--dark-green);
|
| 53 |
-
line-height: 1.
|
| 54 |
-
|
| 55 |
}
|
|
|
|
|
|
|
| 56 |
"""
|
| 57 |
|
| 58 |
-
# --- ال
|
| 59 |
def get_real_total():
|
| 60 |
-
"""جلب عدد الملفات الحقيقي من Hugging Face"""
|
| 61 |
try:
|
| 62 |
files = api.list_repo_files(repo_id=REPO_ID, repo_type="dataset", token=HF_TOKEN)
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
except: return "جاري ال��حميل..."
|
| 66 |
-
|
| 67 |
-
INITIAL_TOTAL = get_real_total()
|
| 68 |
|
| 69 |
-
def clean_text(text):
|
| 70 |
-
return re.sub(r'<[^>]*>', '', text).strip()
|
| 71 |
|
| 72 |
def fetch_surah(s_idx):
|
| 73 |
try:
|
|
@@ -76,109 +86,97 @@ def fetch_surah(s_idx):
|
|
| 76 |
return [{"surah": s_idx, "ayah": v["ayah"], "text": clean_text(v.get("text_ar", "")), "surah_name": SURAH_NAMES[s_idx-1]} for v in res["verses"]]
|
| 77 |
except: return []
|
| 78 |
|
| 79 |
-
# تحميل البيانات بسرعة باستخدام التوازي
|
| 80 |
with ThreadPoolExecutor(max_workers=10) as executor:
|
| 81 |
results = list(executor.map(fetch_surah, range(1, 115)))
|
| 82 |
ALL_AYAT = [item for sublist in results for item in sublist]
|
| 83 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 84 |
def jump_to_ayah(s_name, a_num):
|
| 85 |
-
"""منطق البحث عن آية محددة"""
|
| 86 |
try:
|
| 87 |
target_num = int(a_num)
|
| 88 |
for i, v in enumerate(ALL_AYAT):
|
| 89 |
if v['surah_name'] == s_name and v['ayah'] == target_num:
|
| 90 |
-
|
| 91 |
-
|
|
|
|
|
|
|
| 92 |
except:
|
| 93 |
-
return "⚠️ يرجى إدخال رقم
|
| 94 |
|
| 95 |
def on_submit(audio, current_idx):
|
| 96 |
-
if not audio:
|
| 97 |
-
return "⚠️ يرجى تسجيل الصوت أولاً", gr.update(), gr.update(), current_idx
|
| 98 |
-
|
| 99 |
v = ALL_AYAT[current_idx]
|
| 100 |
try:
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
repo_id=REPO_ID,
|
| 107 |
-
repo_type="dataset",
|
| 108 |
-
token=HF_TOKEN
|
| 109 |
-
)
|
| 110 |
-
# اختيار آية عشوائية تالية
|
| 111 |
-
next_idx = random.randint(0, len(ALL_AYAT)-1)
|
| 112 |
nv = ALL_AYAT[next_idx]
|
| 113 |
-
return "✅ تم الحفظ
|
| 114 |
-
except Exception as e:
|
| 115 |
-
return f"❌ خطأ في الرفع: {str(e)}", gr.update(), gr.update(), current_idx
|
| 116 |
|
| 117 |
-
# ---
|
| 118 |
-
with gr.Blocks(title="م
|
| 119 |
idx_state = gr.State(random.randint(0, len(ALL_AYAT)-1))
|
| 120 |
-
|
| 121 |
-
#
|
| 122 |
gr.HTML(f"""
|
| 123 |
<div class="hero-header">
|
| 124 |
-
<h1
|
| 125 |
-
<p
|
| 126 |
-
<div style="
|
| 127 |
-
<span
|
| 128 |
-
<div class="real-count">{
|
| 129 |
</div>
|
| 130 |
</div>
|
| 131 |
""")
|
| 132 |
|
| 133 |
-
with gr.Column(
|
| 134 |
-
# صندوق التعليمات
|
| 135 |
gr.HTML("""
|
| 136 |
<div class="instruction-box">
|
| 137 |
-
<
|
| 138 |
-
|
| 139 |
-
اقرأ الآية بنَفَس واحد أو قف وقوفاً صحيحاً دون تكرار كلمات سابقة.
|
| 140 |
</div>
|
| 141 |
""")
|
| 142 |
|
| 143 |
with gr.Row():
|
| 144 |
-
#
|
| 145 |
with gr.Column(scale=2):
|
| 146 |
-
with gr.Column(elem_classes="
|
| 147 |
v_init = ALL_AYAT[idx_state.value]
|
| 148 |
info_text = gr.Markdown(f"### {v_init['surah_name']} | آية {v_init['ayah']}")
|
| 149 |
text_html = gr.HTML(f"<div class='ayah-text'>{v_init['text']}</div>")
|
| 150 |
status_msg = gr.Markdown("")
|
| 151 |
-
|
| 152 |
with gr.Row():
|
| 153 |
-
send_btn = gr.Button("🎤 إرسال ال
|
| 154 |
rnd_btn = gr.Button("🔄 آية عشوائية", variant="secondary")
|
| 155 |
|
| 156 |
-
#
|
| 157 |
with gr.Column(scale=1):
|
| 158 |
-
with gr.
|
| 159 |
-
gr.Markdown("### 🎙️ ا
|
| 160 |
audio_ui = gr.Audio(sources=["microphone"], type="filepath", label=None)
|
| 161 |
|
| 162 |
-
with gr.
|
| 163 |
-
|
|
|
|
| 164 |
a_num = gr.Number(label="رقم الآية", value=1, precision=0)
|
| 165 |
-
go_btn = gr.Button("انتق
|
| 166 |
-
|
| 167 |
-
# --- إدارة الأحداث ---
|
| 168 |
-
|
| 169 |
-
# آية عشوائية
|
| 170 |
-
def get_next_random():
|
| 171 |
-
i = random.randint(0, len(ALL_AYAT)-1)
|
| 172 |
-
v = ALL_AYAT[i]
|
| 173 |
-
return f"<div class='ayah-text'>{v['text']}</div>", f"### {v['surah_name']} | آية {v['ayah']}", i, ""
|
| 174 |
|
|
|
|
| 175 |
rnd_btn.click(
|
| 176 |
-
|
| 177 |
outputs=[text_html, info_text, idx_state, status_msg],
|
| 178 |
show_progress="hidden"
|
| 179 |
)
|
| 180 |
|
| 181 |
-
# الانتقال لآية محددة
|
| 182 |
go_btn.click(
|
| 183 |
jump_to_ayah,
|
| 184 |
inputs=[s_drop, a_num],
|
|
@@ -186,7 +184,6 @@ with gr.Blocks(title="مشروع الذكاء الاصطناعي لتصحيح ا
|
|
| 186 |
show_progress="hidden"
|
| 187 |
)
|
| 188 |
|
| 189 |
-
# الإرسال
|
| 190 |
send_btn.click(
|
| 191 |
on_submit,
|
| 192 |
inputs=[audio_ui, idx_state],
|
|
@@ -194,6 +191,5 @@ with gr.Blocks(title="مشروع الذكاء الاصطناعي لتصحيح ا
|
|
| 194 |
show_progress="minimal"
|
| 195 |
)
|
| 196 |
|
| 197 |
-
# تشغيل التطبيق
|
| 198 |
if __name__ == "__main__":
|
| 199 |
demo.launch(css=custom_css)
|
|
|
|
| 7 |
from huggingface_hub import HfApi
|
| 8 |
from concurrent.futures import ThreadPoolExecutor
|
| 9 |
|
| 10 |
+
# --- الإعدادات الأساسية ---
|
| 11 |
HF_TOKEN = os.getenv("HF_TOKEN")
|
| 12 |
REPO_ID = "Alide21/speech_quran"
|
| 13 |
api = HfApi()
|
| 14 |
|
| 15 |
SURAH_NAMES = ["الفاتحة", "البقرة", "آل عمران", "النساء", "المائدة", "الأنعام", "الأعراف", "الأنفال", "التوبة", "يونس", "هود", "يوسف", "الرعد", "إبراهيم", "الحجر", "النحل", "الإسراء", "الكهف", "مريم", "طه", "الأنبياء", "الحج", "المؤمنون", "النور", "الفرقان", "الشعراء", "النمل", "القصص", "العنكبوت", "الروم", "لقمان", "السجدة", "الأحزاب", "سبأ", "فاطر", "يس", "الصافات", "ص", "الزمر", "غافر", "فصلت", "الشورى", "الزخرف", "الدخان", "الجاثية", "الأحقاف", "محمد", "الفتح", "الحجرات", "ق", "الذاريات", "الطور", "النجم", "القمر", "الرحمن", "الواقعة", "الحديد", "المجادلة", "الحشر", "الممتحنة", "الصف", "الجمعة", "المنافقون", "التغابن", "الطلاق", "التحريم", "الملك", "القلم", "الحاقة", "المعارج", "نوح", "الجن", "المزمل", "المدثر", "القيامة", "الإنسان", "المرسلات", "النبأ", "النازعات", "عبس", "التكوير", "الانفطار", "المطففين", "الانشقاق", "البروج", "الطارق", "الأعلى", "الغاشية", "الفجر", "البلد", "الشمس", "الليل", "الضحى", "الشرح", "التين", "العلق", "القدر", "البينة", "الزلزلة", "العاديات", "القارعة", "التكاثر", "العصر", "الهمزة", "الفيل", "قريش", "الماعون", "الكوثر", "الكافرون", "النصر", "المسد", "الإخلاص", "الفلق", "الناس"]
|
| 16 |
|
| 17 |
+
# --- التنسيق البصري الفخم ---
|
| 18 |
custom_css = """
|
| 19 |
@import url('https://fonts.googleapis.com/css2?family=Amiri:wght@400;700&family=Reem+Kufi:wght@400;700&display=swap');
|
| 20 |
+
|
| 21 |
:root { --gold: #D4AF37; --dark-green: #064635; }
|
|
|
|
| 22 |
|
| 23 |
+
body { direction: rtl; background-color: #f0f2f5; }
|
| 24 |
+
|
| 25 |
+
/* الهيدر مع خلفية الصورة المعتمة */
|
| 26 |
.hero-header {
|
| 27 |
+
background: linear-gradient(rgba(6, 70, 53, 0.85), rgba(6, 70, 53, 0.85)),
|
| 28 |
+
url('https://images.unsplash.com/photo-1609599006353-e629aaabfeae?q=80&w=2070&auto=format&fit=crop');
|
| 29 |
+
background-size: cover;
|
| 30 |
+
background-position: center;
|
| 31 |
+
padding: 40px 20px;
|
| 32 |
+
border-radius: 0 0 50px 50px;
|
| 33 |
text-align: center;
|
| 34 |
+
color: white !important;
|
| 35 |
+
box-shadow: 0 10px 30px rgba(0,0,0,0.2);
|
| 36 |
}
|
| 37 |
+
|
| 38 |
+
.hero-header h1, .hero-header p, .hero-header span { color: white !important; }
|
| 39 |
+
|
| 40 |
+
.real-count { font-size: 4rem; color: var(--gold); font-weight: bold; line-height: 1; text-shadow: 2px 2px 10px rgba(0,0,0,0.5); }
|
| 41 |
+
|
| 42 |
.instruction-box {
|
| 43 |
background: #fff9e6;
|
| 44 |
+
border-right: 5px solid var(--gold);
|
| 45 |
+
padding: 15px;
|
| 46 |
+
border-radius: 15px;
|
| 47 |
+
margin: 20px 0;
|
| 48 |
+
font-size: 1rem;
|
| 49 |
+
box-shadow: 0 4px 6px rgba(0,0,0,0.05);
|
| 50 |
}
|
| 51 |
+
|
| 52 |
+
/* موحد لكل البطاقات */
|
| 53 |
+
.custom-card {
|
| 54 |
+
background: white !important;
|
| 55 |
+
border-radius: 25px !important;
|
| 56 |
+
padding: 25px !important;
|
| 57 |
+
box-shadow: 0 10px 25px rgba(0,0,0,0.05) !important;
|
| 58 |
+
border: 1px solid #eee !important;
|
| 59 |
+
margin-bottom: 20px !important;
|
| 60 |
}
|
| 61 |
+
|
| 62 |
.ayah-text {
|
| 63 |
font-family: 'Amiri', serif !important;
|
| 64 |
+
font-size: 2.2rem !important;
|
| 65 |
color: var(--dark-green);
|
| 66 |
+
line-height: 1.8 !important;
|
| 67 |
+
text-align: center;
|
| 68 |
}
|
| 69 |
+
|
| 70 |
+
.status-label { font-weight: bold; padding: 10px; border-radius: 10px; }
|
| 71 |
"""
|
| 72 |
|
| 73 |
+
# --- المنطق الخلفي ---
|
| 74 |
def get_real_total():
|
|
|
|
| 75 |
try:
|
| 76 |
files = api.list_repo_files(repo_id=REPO_ID, repo_type="dataset", token=HF_TOKEN)
|
| 77 |
+
return len([f for f in files if f.startswith("data/")])
|
| 78 |
+
except: return 0
|
|
|
|
|
|
|
|
|
|
| 79 |
|
| 80 |
+
def clean_text(text): return re.sub(r'<[^>]*>', '', text).strip()
|
|
|
|
| 81 |
|
| 82 |
def fetch_surah(s_idx):
|
| 83 |
try:
|
|
|
|
| 86 |
return [{"surah": s_idx, "ayah": v["ayah"], "text": clean_text(v.get("text_ar", "")), "surah_name": SURAH_NAMES[s_idx-1]} for v in res["verses"]]
|
| 87 |
except: return []
|
| 88 |
|
|
|
|
| 89 |
with ThreadPoolExecutor(max_workers=10) as executor:
|
| 90 |
results = list(executor.map(fetch_surah, range(1, 115)))
|
| 91 |
ALL_AYAT = [item for sublist in results for item in sublist]
|
| 92 |
|
| 93 |
+
def validate_ayah(v):
|
| 94 |
+
"""التحقق من طول الآية (أقل من 200 كلمة)"""
|
| 95 |
+
word_count = len(v['text'].split())
|
| 96 |
+
if word_count > 200:
|
| 97 |
+
return False
|
| 98 |
+
return True
|
| 99 |
+
|
| 100 |
def jump_to_ayah(s_name, a_num):
|
|
|
|
| 101 |
try:
|
| 102 |
target_num = int(a_num)
|
| 103 |
for i, v in enumerate(ALL_AYAT):
|
| 104 |
if v['surah_name'] == s_name and v['ayah'] == target_num:
|
| 105 |
+
if not validate_ayah(v):
|
| 106 |
+
return "⚠️ عذراً، هذه الآية طويلة جداً (أكثر من 200 كلمة)", gr.update(), gr.update(), gr.update()
|
| 107 |
+
return "✅ تم الانتقال للآية", f"<div class='ayah-text'>{v['text']}</div>", f"### {v['surah_name']} | آية {v['ayah']}", i
|
| 108 |
+
return "⚠️ لم يتم العثور على الآية، تأكد من رقم الآية في السورة", gr.update(), gr.update(), gr.update()
|
| 109 |
except:
|
| 110 |
+
return "⚠️ يرجى إدخال رقم صحيح", gr.update(), gr.update(), gr.update()
|
| 111 |
|
| 112 |
def on_submit(audio, current_idx):
|
| 113 |
+
if not audio: return "⚠️ سجل صوتك أولاً", gr.update(), gr.update(), current_idx
|
|
|
|
|
|
|
| 114 |
v = ALL_AYAT[current_idx]
|
| 115 |
try:
|
| 116 |
+
api.upload_file(path_or_fileobj=audio, path_in_repo=f"data/s{v['surah']}_a{v['ayah']}_{uuid.uuid4().hex[:6]}.wav", repo_id=REPO_ID, repo_type="dataset", token=HF_TOKEN)
|
| 117 |
+
# اختيار آية عشوائية تالية صالحة
|
| 118 |
+
while True:
|
| 119 |
+
next_idx = random.randint(0, len(ALL_AYAT)-1)
|
| 120 |
+
if validate_ayah(ALL_AYAT[next_idx]): break
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 121 |
nv = ALL_AYAT[next_idx]
|
| 122 |
+
return "✅ تم الحفظ، جزاك الله خيراً", f"<div class='ayah-text'>{nv['text']}</div>", f"### {nv['surah_name']} | آية {nv['ayah']}", next_idx
|
| 123 |
+
except Exception as e: return f"❌ فشل الرفع: {str(e)}", gr.update(), gr.update(), current_idx
|
|
|
|
| 124 |
|
| 125 |
+
# --- واجهة المستخدم ---
|
| 126 |
+
with gr.Blocks(title="مِنَصَّة تلاوة - ذكاء اصطناعي") as demo:
|
| 127 |
idx_state = gr.State(random.randint(0, len(ALL_AYAT)-1))
|
| 128 |
+
|
| 129 |
+
# 1. الهيدر الفخم
|
| 130 |
gr.HTML(f"""
|
| 131 |
<div class="hero-header">
|
| 132 |
+
<h1>مِنَصَّة التِّلَاوَة</h1>
|
| 133 |
+
<p>مشروع تقني لبناء نموذج ذكاء اصطناعي لتصحيح التجويد وتلاوة القرآن</p>
|
| 134 |
+
<div style="margin-top:20px;">
|
| 135 |
+
<span>إجمالي المساهمات الحقيقية</span>
|
| 136 |
+
<div class="real-count">{get_real_total()}</div>
|
| 137 |
</div>
|
| 138 |
</div>
|
| 139 |
""")
|
| 140 |
|
| 141 |
+
with gr.Column(elem_classes="gradio-container"):
|
|
|
|
| 142 |
gr.HTML("""
|
| 143 |
<div class="instruction-box">
|
| 144 |
+
<b>💡 إرشادات:</b> يرجى قراءة الآية بوضوح وتجنب تكرار الكلمات عند الوقف الخاطئ.
|
| 145 |
+
الهدف هو جمع تلاوات نقية لتدريب ذكاء اصطناعي يخدم كتاب الله.
|
|
|
|
| 146 |
</div>
|
| 147 |
""")
|
| 148 |
|
| 149 |
with gr.Row():
|
| 150 |
+
# اليمين: عرض الآية
|
| 151 |
with gr.Column(scale=2):
|
| 152 |
+
with gr.Column(elem_classes="custom-card"):
|
| 153 |
v_init = ALL_AYAT[idx_state.value]
|
| 154 |
info_text = gr.Markdown(f"### {v_init['surah_name']} | آية {v_init['ayah']}")
|
| 155 |
text_html = gr.HTML(f"<div class='ayah-text'>{v_init['text']}</div>")
|
| 156 |
status_msg = gr.Markdown("")
|
|
|
|
| 157 |
with gr.Row():
|
| 158 |
+
send_btn = gr.Button("🎤 إرسال التلاوة", variant="primary")
|
| 159 |
rnd_btn = gr.Button("🔄 آية عشوائية", variant="secondary")
|
| 160 |
|
| 161 |
+
# اليسار: التحكم والتسجيل
|
| 162 |
with gr.Column(scale=1):
|
| 163 |
+
with gr.Column(elem_classes="custom-card"):
|
| 164 |
+
gr.Markdown("### 🎙️ التسجيل الصوتي")
|
| 165 |
audio_ui = gr.Audio(sources=["microphone"], type="filepath", label=None)
|
| 166 |
|
| 167 |
+
with gr.Column(elem_classes="custom-card"):
|
| 168 |
+
gr.Markdown("### 🔍 اختيار آية محددة")
|
| 169 |
+
s_drop = gr.Dropdown(choices=SURAH_NAMES, label="السورة", value="الفاتحة")
|
| 170 |
a_num = gr.Number(label="رقم الآية", value=1, precision=0)
|
| 171 |
+
go_btn = gr.Button("انتقال سريع")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 172 |
|
| 173 |
+
# الأحداث
|
| 174 |
rnd_btn.click(
|
| 175 |
+
lambda: (v:=ALL_AYAT[i:=random.randint(0,len(ALL_AYAT)-1)]) and (f"<div class='ayah-text'>{v['text']}</div>", f"### {v['surah_name']} | آية {v['ayah']}", i, ""),
|
| 176 |
outputs=[text_html, info_text, idx_state, status_msg],
|
| 177 |
show_progress="hidden"
|
| 178 |
)
|
| 179 |
|
|
|
|
| 180 |
go_btn.click(
|
| 181 |
jump_to_ayah,
|
| 182 |
inputs=[s_drop, a_num],
|
|
|
|
| 184 |
show_progress="hidden"
|
| 185 |
)
|
| 186 |
|
|
|
|
| 187 |
send_btn.click(
|
| 188 |
on_submit,
|
| 189 |
inputs=[audio_ui, idx_state],
|
|
|
|
| 191 |
show_progress="minimal"
|
| 192 |
)
|
| 193 |
|
|
|
|
| 194 |
if __name__ == "__main__":
|
| 195 |
demo.launch(css=custom_css)
|