mj-new commited on
Commit
da5bc42
1 Parent(s): 26c14ca

Slight tweaks in UI and parsing text fields

Browse files
Files changed (1) hide show
  1. app.py +12 -12
app.py CHANGED
@@ -60,12 +60,12 @@ def save_recording_and_meta(project_name, recording, prompt_text, language_code,
60
  prompt_number = 1
61
 
62
  speaker_metadata={}
63
- speaker_metadata['name'] = spk_name if spk_name !='' else 'unknown'
64
- speaker_metadata['gender'] = spk_gender if spk_gender !='' else 'unknown'
65
- speaker_metadata['age'] = spk_age if spk_age !='' else 'unknown'
66
- speaker_metadata['accent'] = spk_accent if spk_accent !='' else 'unknown'
67
- speaker_metadata['city'] = spk_city if spk_city !='' else 'unknown'
68
- speaker_metadata['nativity'] = spk_nativity if spk_nativity !='' else 'unknown'
69
 
70
  # TODO get ISO-693-1 codes
71
  prompt_text =prompt_text.strip()
@@ -135,7 +135,7 @@ def save_recording_and_meta(project_name, recording, prompt_text, language_code,
135
  prompt_number = prompt_number + 1
136
 
137
  # check if this is the last prompt
138
- if prompt_number == len(promptset):
139
  prompt_number = 0
140
  prompt = "All prompts recorded. Thank you! You can close the app now:)"
141
  else:
@@ -337,11 +337,11 @@ with block:
337
  """
338
  with gr.TabItem('Speaker information'):
339
  with gr.Row():
340
- spk_name = gr.Textbox(placeholder="Your name", label="Speaker name")
341
- dropdown_spk_nativity = gr.Dropdown(["Polish", "Other"], label="Speaker native language", info="")
342
- dropdown_spk_gender = gr.Dropdown(["Male", "Female", "Other", "Prefer not to say"], label="Speaker gender", info="")
343
- dropdown_spk_age = gr.Dropdown(["under 20", "20-29", "30-39", "40-49", "50-59", "over 60"], label="Speaker age range", info="")
344
- dropdown_spk_origin_city = gr.Dropdown(cities, label="Home town", visible=True, info="Closest city to speaker's place of birth and upbringing")
345
  #radio_gdpr_consent = gr.Radio(["Yes", "No"], label="Personal data processing consent", info="Do you agree for your personal data processing according to the policy (link)")
346
  dropdown_spk_nativity.change(fn=change_nativity, inputs=dropdown_spk_nativity, outputs=spk_age)
347
  dropdown_spk_gender.change(fn=change_gender, inputs=dropdown_spk_gender, outputs=spk_gender)
 
60
  prompt_number = 1
61
 
62
  speaker_metadata={}
63
+ speaker_metadata['name'] = spk_name if spk_name != None else 'unknown'
64
+ speaker_metadata['gender'] = spk_gender if spk_gender != None else 'unknown'
65
+ speaker_metadata['age'] = spk_age if spk_age != None else 'unknown'
66
+ speaker_metadata['accent'] = spk_accent if spk_accent != None else 'unknown'
67
+ speaker_metadata['city'] = spk_city if spk_city != None else 'unknown'
68
+ speaker_metadata['nativity'] = spk_nativity if spk_nativity != None else 'unknown'
69
 
70
  # TODO get ISO-693-1 codes
71
  prompt_text =prompt_text.strip()
 
135
  prompt_number = prompt_number + 1
136
 
137
  # check if this is the last prompt
138
+ if prompt_number == len(promptset)+1:
139
  prompt_number = 0
140
  prompt = "All prompts recorded. Thank you! You can close the app now:)"
141
  else:
 
337
  """
338
  with gr.TabItem('Speaker information'):
339
  with gr.Row():
340
+ spk_name = gr.Textbox(placeholder="Your name", label="Name")
341
+ dropdown_spk_nativity = gr.Dropdown(["Polish", "Other"], label="Native language", info="")
342
+ dropdown_spk_gender = gr.Dropdown(["Male", "Female", "Other", "Prefer not to say"], label="Gender", info="")
343
+ dropdown_spk_age = gr.Dropdown(["under 20", "20-29", "30-39", "40-49", "50-59", "over 60"], label="Age", info="")
344
+ dropdown_spk_origin_city = gr.Dropdown(cities, label="Hometown", visible=True, info="Closest city to speaker's place of birth and upbringing")
345
  #radio_gdpr_consent = gr.Radio(["Yes", "No"], label="Personal data processing consent", info="Do you agree for your personal data processing according to the policy (link)")
346
  dropdown_spk_nativity.change(fn=change_nativity, inputs=dropdown_spk_nativity, outputs=spk_age)
347
  dropdown_spk_gender.change(fn=change_gender, inputs=dropdown_spk_gender, outputs=spk_gender)