AhmedAshrafMarzouk commited on
Commit
c1700b1
·
verified ·
1 Parent(s): 068e5df

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +26 -72
app.py CHANGED
@@ -232,34 +232,14 @@ GENDERS = ["Male", "Female"]
232
 
233
  RECORDING_INSTRUCTIONS = """
234
  <div dir="rtl" style="text-align: right">
235
-
236
- ### تعليمات التسجيل
237
- 1. **البيئة**: سجّل في مكان هادئ قد ما تقدر، وحاول ما يكون فيه ضوضاء أو أصوات في الخلفية.
238
- 2. **الميكروفون**: يفضّل تستخدم مايك سماعة أو مايك خارجي، لأنه غالبًا بيكون أوضح بكثير من مايك اللابتوب أو الجوال.
239
- 3. **طريقة التحدث**: اقرأ الجملة بصوت واضح وطبيعي، وبلهجتك. لا تغيّر أو تستبدل أي كلمة أبدًا، إلا لو كان فيه اختلاف بالنطق مثل: "ثلاثة" و"تلاتة" — هذا عادي. إذا حسّيت إنك ما تبغى تسجل جملة معينة أو ما عرفت تنطقها، عادي اضغط "Skip".
240
- 4. **التعديل**: تقدر تعدل الجملة قبل لا تسجل إذا ودك.
241
- 5. **الحفظ**: بعد ما تسجل، اضغط "Save & Next" عشان تحفظ تسجيلك. إذا ودك تعيد، استخدم "Discard"، أو اضغط "Skip" عشان تروح للجملة اللي بعدها.
242
- 6. **المدة**: حاول تسجل عدد كافي من الجمل، كل تسجيل يساعدنا أكثر! حاول يكون مجموع تسجيلاتك على الأقل 30 دقيقة، ونقدّر وقتك وجهدك 🙏
243
-
244
- إذا عندك أي مشكلة أو استفسار، تواصل معي على الإيميل:
245
- Fadel.HA@outlook.com
246
-
247
  </div>
248
  """
249
 
250
  RECORDING_INSTRUCTIONS_M = """
251
  <div dir="rtl" style="text-align: right">
252
 
253
- ### تعليمات التسجيل
254
- 1. **البيئة**: سجّل في مكان هادئ قد ما تقدر، وحاول ما يكون فيه ضوضاء أو أصوات في الخلفية.
255
- 2. **الميكروفون**: يفضّل تستخدم مايك سماعة أو مايك خارجي، لأنه غالبًا بيكون أوضح بكثير من مايك اللابتوب أو الجوال.
256
- 3. **طريقة التحدث**: اقرأ الجملة بصوت واضح وطبيعي، وبلهجتك. لا تغيّر أو تستبدل أي كلمة أبدًا، إلا لو كان فيه اختلاف بالنطق مثل: "ثلاثة" و"تلاتة" — هذا عادي. إذا حسّيت إنك ما تبغى تسجل جملة معينة أو ما عرفت تنطقها، عادي اضغط "Skip".
257
- 4. **التعديل**: تقدر تعدل الجملة قبل لا تسجل إذا ودك.
258
- 5. **الحفظ**: بعد ما تسجل، اضغط "Save & Next" عشان تحفظ تسجيلك. إذا ودك تعيد، استخدم "Discard"، أو اضغط "Skip" عشان تروح للجملة اللي بعدها.
259
- 6. **المدة**: حاول تسجل عدد كافي من الجمل، كل تسجيل يساعدنا أكثر! حاول يكون مجموع تسجيلاتك على الأقل 30 دقيقة، ونقدّر وقتك وجهدك 🙏
260
-
261
- إذا عندك أي مشكلة أو استفسار، تواصل معي على الإيميل:
262
- Fadel.HA@outlook.com
263
 
264
  </div>
265
  """
@@ -267,54 +247,24 @@ Fadel.HA@outlook.com
267
  RECORDING_INSTRUCTIONS_F = """
268
  <div dir="rtl" style="text-align: right">
269
 
270
- ### تعليمات التسجيل
271
- 1. **البيئة**: سجّلي في مكان هادئ قد ما تقدري، وحاولي ما يكون فيه ضوضاء أو أصوات في الخلفية.
272
- 2. **الميكروفون**: يُفضّل تستخدمي مايك سماعة أو مايك خارجي، لأنه غالبًا بيكون أوضح بكثير من مايك ا��لابتوب أو الجوال.
273
- 3. **طريقة التحدث**: اقري الجملة بصوت واضح وطبيعي، وبلهجتك. لا تغيّري أو تستبدلي أي كلمة أبدًا، إلا لو كان فيه اختلاف بالنطق مثل: "ثلاثة" و"تلاتة" — هذا عادي. إذا حسّيتي إنك ما تبغي تسجلي جملة معيّنة أو ما عرفتي تنطقيها، عادي أضغطي "Skip".
274
- 4. **التعديل**: تقدري تعدّلي الجملة قبل لا تسجلي إذا ودك.
275
- 5. **الحفظ**: بعد ما تسجّلي، اضغطي "Save & Next" عشان تحفظي تسجيلك. إذا تبغطي تعيدي، استخدمي "Discard"، أو اضغطي "Skip" عشان تروحي للجملة اللي بعدها.
276
- 6. **المدة**: حاولي تسجّلي عدد كافي من الجمل، كل تسجيل يساعدنا أكثر! حاولي يكون مجموع تسجيلاتك على الأقل 30 دقيقة، ونقدّر وقتك وجهدك 🙏
277
-
278
- إذا عندك أي مشكلة أو استفسار، تواصلي معي على الإيميل:
279
- Fadel.HA@outlook.com
 
 
280
 
281
  </div>
282
  """
283
 
284
  CONSENT_DETAILS = """
285
- ### DATA COLLECTION AND USAGE AGREEMENT
286
- For Audio Deepfake Detection Dataset (TTS & Voice Conversion)
287
-
288
- This Agreement is entered into between the undersigned individual (hereafter referred to as the "Participant") and the Research Team from KFUPM and Taibah universities (hereafter referred to as the "Collector"), for the purpose of collecting, using, and distributing audio data to support research in audio deepfake detection.
289
-
290
- **1. Purpose of Data Collection**:
291
- The Collector is collecting audio data for the creation of a dataset focused on detecting synthetic audio generated via text-to-speech (TTS) and voice conversion technologies. The dataset will be used to support academic and scientific research in the field of artificial intelligence, particularly for the development of methods to detect audio deepfakes.
292
-
293
- **2. Nature of Data Collected**:
294
- The Participant agrees to provide the following:
295
- Spoken audio recordings based on provided scripts (text-to-speech mimicry and/or natural voice).
296
- Optional metadata such as gender, age range, and accent.
297
- Consent to synthetically modify their voice using TTS and/or voice conversion techniques.
298
-
299
- **3. Rights Granted**:
300
- The Participant grants the Collector the non-exclusive, worldwide, royalty-free, irrevocable right to:
301
- Record, process, and use the audio data and its synthetic versions.
302
- Distribute the dataset, including natural and synthetic audio, publicly to the research community for non-commercial research and educational purposes.
303
- Share audio samples on professional or academic social media platforms (e.g., LinkedIn, Twitter, YouTube) to raise awareness about deepfake research, dataset availability, or to demonstrate examples of synthetic audio.
304
-
305
- **4. Public Availability**:
306
- The dataset, including real and synthetic samples, will be released under an open license (e.g., Creative Commons Attribution 4.0 International License) that allows other researchers to freely use and share the data for academic, non-commercial purposes.
307
-
308
- **5. Data Privacy and Anonymity**:
309
- The dataset will not include the Participant’s real name or other personally identifiable information unless explicit written consent is provided.
310
- Participants may be assigned anonymized IDs.
311
- While voice data may inherently contain identifiable characteristics, efforts will be made to minimize privacy risks in line with research ethics guidelines.
312
-
313
- **6. Voluntary Participation and Withdrawal**:
314
- Participation in this data collection is entirely voluntary. The Participant may withdraw their consent and request deletion of their data before the dataset is finalized and published. Once the dataset is publicly released, withdrawal may not be feasible due to the nature of data dissemination.
315
-
316
- **7. No Compensation**:
317
- Participants acknowledge that no monetary compensation is provided for participation or data usage, and that participation is for the advancement of scientific research.
318
  """
319
 
320
 
@@ -803,9 +753,10 @@ def main_app_interface():
803
  )
804
 
805
  with gr.Row(visible=False) as button_row:
806
- save_button = gr.Button("Save & Next (N)")
807
- discard_button = gr.Button("Discard (D)")
808
- skip_button = gr.Button("Skip (S)")
 
809
 
810
  # Session status
811
  with gr.Row(visible=False) as status_row:
@@ -814,7 +765,7 @@ def main_app_interface():
814
  return (
815
  main_title, user_row, username_display, logout_button, instructions_accordion,
816
  instructions_display, recording_row, current_sentence_display, sentence_id_display,
817
- progress_display, audio_row, audio_recorder, button_row, save_button, discard_button,
818
  skip_button, status_row, session_status
819
  )
820
 
@@ -855,7 +806,7 @@ def create_app():
855
  (
856
  main_title, user_row, username_display, logout_button, instructions_accordion,
857
  instructions_display, recording_row, current_sentence_display, sentence_id_display,
858
- progress_display, audio_row, audio_recorder, button_row, save_button, discard_button,
859
  skip_button, status_row, session_status
860
  ) = main_app_interface()
861
 
@@ -942,6 +893,7 @@ def create_app():
942
  gr.update(visible=True), # audio_row
943
  gr.update(visible=True), # audio_recorder
944
  gr.update(visible=True), # button_row
 
945
  gr.update(visible=True), # save_button
946
  gr.update(visible=True), # discard_button
947
  gr.update(visible=True), # skip_button
@@ -980,6 +932,7 @@ def create_app():
980
  gr.update(visible=False), # audio_row
981
  gr.update(visible=False), # audio_recorder
982
  gr.update(visible=False), # button_row
 
983
  gr.update(visible=False), # save_button
984
  gr.update(visible=False), # discard_button
985
  gr.update(visible=False), # skip_button
@@ -1047,6 +1000,7 @@ def create_app():
1047
  gr.update(visible=False), # audio_row
1048
  gr.update(visible=False), # audio_recorder
1049
  gr.update(visible=False), # button_row
 
1050
  gr.update(visible=False), # save_button
1051
  gr.update(visible=False), # discard_button
1052
  gr.update(visible=False), # skip_button
@@ -1299,7 +1253,7 @@ def create_app():
1299
  register_city, register_gender, register_consent, consent_details, register_button,
1300
  register_message, main_title, user_row, username_display, logout_button,
1301
  instructions_accordion, instructions_display, recording_row, current_sentence_display,
1302
- sentence_id_display, progress_display, audio_row, audio_recorder, button_row, save_button,
1303
  discard_button, skip_button, status_row, session_status
1304
  ]
1305
  )
@@ -1320,7 +1274,7 @@ def create_app():
1320
  register_city, register_gender, register_consent, consent_details, register_button,
1321
  register_message, main_title, user_row, username_display, logout_button,
1322
  instructions_accordion, instructions_display, recording_row, current_sentence_display,
1323
- sentence_id_display, progress_display, audio_row, audio_recorder, button_row, save_button,
1324
  discard_button, skip_button, status_row, session_status
1325
  ]
1326
  )
 
232
 
233
  RECORDING_INSTRUCTIONS = """
234
  <div dir="rtl" style="text-align: right">
235
+ <ul> <li>سجّل بمكان هادي وما فيه إزعاج.</li> <li>خل المايك أو الجوال قريب من وجهك (٢٠ – ٣٠ سم تقريبًا).</li> <li>تكلم بصوت واضح وطبيعي، زي ما تتكلم عادة.</li> <li>حاول يكون الصوت ثابت، لا تعلي مرة ولا توطي مرة.</li> <li>إذا غلطت بكلمة، اقفل التسجيل وأعده من جديد.</li> <li>لو في جملة ما ودك تسجلها، تقدر تختار «تخطي».</li> <li> إذا واجهتك أي مشكلة أو عندك استفسار، تواصل معنا على الإيميل: <a href="mailto:a.a.elghawas@gmail.com">a.a.elghawas@gmail.com</a> </li> </ul>
 
 
 
 
 
 
 
 
 
 
 
236
  </div>
237
  """
238
 
239
  RECORDING_INSTRUCTIONS_M = """
240
  <div dir="rtl" style="text-align: right">
241
 
242
+ <ul> <li>سجّل بمكان هادي وما فيه إزعاج.</li> <li>خل المايك أو الجوال قريب من وجهك (٢٠ – ٣٠ سم تقريبًا).</li> <li>تكلم بصوت واضح وطبيعي، زي ما تتكلم عادة.</li> <li>حاول يكون الصوت ثابت، لا تعلي مرة ولا توطي مرة.</li> <li>إذا غلطت بكلمة، اقفل التسجيل وأعده من جديد.</li> <li>لو في جملة ما ودك تسجلها، تقدر تختار «تخطي».</li> <li> إذا واجهتك أي مشكلة أو عندك استفسار، تواصل معنا على الإيميل: <a href="mailto:a.a.elghawas@gmail.com">a.a.elghawas@gmail.com</a> </li> </ul>
 
 
 
 
 
 
 
 
 
243
 
244
  </div>
245
  """
 
247
  RECORDING_INSTRUCTIONS_F = """
248
  <div dir="rtl" style="text-align: right">
249
 
250
+ <ul>
251
+ <li>سجّلي في مكان هادي ومفيهوش دوشة.</li>
252
+ <li>خلّي المايك أو الموبايل قريب من وشّك (حوالي ٢٠ ٣٠ سم).</li>
253
+ <li>اتكلمي بصوت واضح وطبيعي زي ما بتتكلمي عادي.</li>
254
+ <li>حاولي تخلي صوتِك ثابت، متعليش مرّة وتوطي مرّة.</li>
255
+ <li>لو غلطتي في كلمة، اقفلي التسجيل وابدئي من الأول.</li>
256
+ <li>لو في جملة مش عايزة تسجّليها، ممكن تختاري «تخطّي».</li>
257
+ <li>
258
+ لو قابلتك أي مشكلة أو عندِك سؤال، ابعتي لنا على الإيميل:
259
+ <a href="mailto:a.a.elghawas@gmail.com">a.a.elghawas@gmail.com</a>
260
+ </li>
261
+ </ul>
262
 
263
  </div>
264
  """
265
 
266
  CONSENT_DETAILS = """
267
+ <section dir="rtl" lang="ar" style="text-align: right"> <h1>الموافقة على جمع واستخدام ال��يانات</h1> <p> الاتفاقية دي ما بين <strong>المشارك (حضرتك)</strong> وبين فريق البحث من <strong>جامعة الملك فهد للبترول والمعادن</strong> و<strong>جامعة طيبة</strong> (اللي هنسميه هنا "الجامعتين"). الاتفاقية مخصوص علشان جمع واستخدام وتوزيع تسجيلات صوتية هتساعد في أبحاث كشف الأصوات المزوّرة (Deepfake) وغيرها من الأبحاث غير التجارية. </p> <ol> <li> <strong>هدف جمع البيانات:</strong><br> الفريق بيجمع تسجيلات صوت علشان يعمل مجموعة بيانات (Dataset) خاصة بالكشف عن الأصوات المصنوعة بالذكاء الاصطناعي باستخدام تقنيات تحويل النص لصوت (TTS) أو تقليد الأصوات (Voice Conversion) وطرق تانية. البيانات دي هتتستخدم في أبحاث علمية وأكاديمية لتطوير طرق أفضل لاكتشاف الأصوات المزوّرة وغيرها من الأبحاث غير التجارية. </li> <li> <strong>طبيعة البيانات اللي هتتجمع:</strong><br> المشارك بيوافق إنه يدي: <ul> <li>تسجيلات صوتية بصوته الطبيعي أو من خلال نصوص/جمل هنطلب منه يقراها.</li> <li>بيانات اختيارية زي: النوع (ذكر/أنثى)، الفئة العمرية، اللهجة، إلخ.</li> <li>موافقة إن صوته يتعدل أو يتغيّر بأساليب صناعية.</li> </ul> </li> <li> <strong>الحقوق الممنوحة:</strong><br> المشارك بيدي الفريق الحق الكامل (من غير فلوس أو قيود) إنه: <ul> <li>يسجّل ويعالج ويستخدم الصوت الطبيعي والنسخ المصنوعة منه.</li> <li>يوزّع مجموعة البيانات (الطبيعية والمصنوعة) للباحثين في المجتمع العلمي لأغراض بحثية غير تجارية فقط.</li> <li>ينشر عينات صوتية على منصات مهنية أو أكاديمية زي LinkedIn، Twitter/X، YouTube علشان يزود الوعي بأبحاث الديب فيك أو يعرّف الناس عن توفر البيانات.</li> </ul> </li> <li> <strong>إتاحة البيانات:</strong><br> المجموعة الصوتية (الطبيعية والمصنوعة) هتتنشر بترخيص مفتوح <em>(Creative Commons Attribution 4.0)</em> يسمح لأي باحث يستخدمها ويشاركها للأغراض الأكاديمية غير التجارية. </li> <li> <strong>الخصوصية والسرية:</strong><br> <ul> <li>مش هيتم نشر اسم المشارك أو أي بيانات شخصية مباشرة إلا بموافقته المكتوبة.</li> <li>المشارك هيكون ليه ID مجهول في مجموعة البيانات.</li> </ul> </li> <li> <strong>المشاركة والانضمام:</strong><br> <ul> <li>المشاركة اختيارية ١٠٠٪.</li> <li>له الحق ينسحب أو يطلب حذف تسجيلاته قبل ما مجموعة البيانات تتنشر للعامة.</li> <li>بعد النشر العام، سحب البيانات مش هيكون ممكن بسبب طريقة توزيعها.</li> </ul> </li> <li> <strong>التعويض:</strong><br> المشارك عارف إن مفيش أي مقابل مادي أو فلوس مقابل تسجيلاته، والمشاركة هنا لدعم وتطوير البحث العلمي فقط. </li> </ol> </section>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
268
  """
269
 
270
 
 
753
  )
754
 
755
  with gr.Row(visible=False) as button_row:
756
+ discard_button = gr.Button("Discard (D)", variant="primary")
757
+ save_button = gr.Button("Save & Next (N)", variant="stop")
758
+ with gr.Row(visible=False) as skip_row:
759
+ skip_button = gr.Button("Skip (S)", variant="secondary")
760
 
761
  # Session status
762
  with gr.Row(visible=False) as status_row:
 
765
  return (
766
  main_title, user_row, username_display, logout_button, instructions_accordion,
767
  instructions_display, recording_row, current_sentence_display, sentence_id_display,
768
+ progress_display, audio_row, audio_recorder, button_row, skip_row, save_button, discard_button,
769
  skip_button, status_row, session_status
770
  )
771
 
 
806
  (
807
  main_title, user_row, username_display, logout_button, instructions_accordion,
808
  instructions_display, recording_row, current_sentence_display, sentence_id_display,
809
+ progress_display, audio_row, audio_recorder, button_row, skip_row, save_button, discard_button,
810
  skip_button, status_row, session_status
811
  ) = main_app_interface()
812
 
 
893
  gr.update(visible=True), # audio_row
894
  gr.update(visible=True), # audio_recorder
895
  gr.update(visible=True), # button_row
896
+ gr.update(visible=True), # skip_row
897
  gr.update(visible=True), # save_button
898
  gr.update(visible=True), # discard_button
899
  gr.update(visible=True), # skip_button
 
932
  gr.update(visible=False), # audio_row
933
  gr.update(visible=False), # audio_recorder
934
  gr.update(visible=False), # button_row
935
+ gr.update(visible=False),
936
  gr.update(visible=False), # save_button
937
  gr.update(visible=False), # discard_button
938
  gr.update(visible=False), # skip_button
 
1000
  gr.update(visible=False), # audio_row
1001
  gr.update(visible=False), # audio_recorder
1002
  gr.update(visible=False), # button_row
1003
+ gr.update(visible=False),
1004
  gr.update(visible=False), # save_button
1005
  gr.update(visible=False), # discard_button
1006
  gr.update(visible=False), # skip_button
 
1253
  register_city, register_gender, register_consent, consent_details, register_button,
1254
  register_message, main_title, user_row, username_display, logout_button,
1255
  instructions_accordion, instructions_display, recording_row, current_sentence_display,
1256
+ sentence_id_display, progress_display, audio_row, audio_recorder, button_row, skip_row, save_button,
1257
  discard_button, skip_button, status_row, session_status
1258
  ]
1259
  )
 
1274
  register_city, register_gender, register_consent, consent_details, register_button,
1275
  register_message, main_title, user_row, username_display, logout_button,
1276
  instructions_accordion, instructions_display, recording_row, current_sentence_display,
1277
+ sentence_id_display, progress_display, audio_row, audio_recorder, button_row, skip_row, save_button,
1278
  discard_button, skip_button, status_row, session_status
1279
  ]
1280
  )