Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -129,10 +129,6 @@ def sample_audio_paths(audio_paths, count_data, k=5, max_count=3):
|
|
| 129 |
|
| 130 |
return selected, count_data
|
| 131 |
|
| 132 |
-
"""random.seed()
|
| 133 |
-
selected_audio_paths = random.sample(all_data_audio_paths, 5)"""
|
| 134 |
-
# print(selected_audio_paths)
|
| 135 |
-
|
| 136 |
count_data = load_or_initialize_count_json(all_data_audio_paths)
|
| 137 |
selected_audio_paths, updated_count_data = sample_audio_paths(all_data_audio_paths, count_data, k=5)
|
| 138 |
|
|
@@ -175,8 +171,8 @@ def show_sample_page_and_init(age, gender, education, education_other, user_data
|
|
| 175 |
def update_sample_view(dimension_title):
|
| 176 |
dim_data = next((d for d in DIMENSIONS_DATA if d["title"] == dimension_title), None)
|
| 177 |
if dim_data:
|
| 178 |
-
|
| 179 |
-
audio_up = gr.update(value=append_cache_buster(dim_data["audio"]))
|
| 180 |
interactive_view_up = gr.update(visible=True)
|
| 181 |
reference_view_up = gr.update(visible=False)
|
| 182 |
reference_btn_up = gr.update(value="参考")
|
|
@@ -238,8 +234,8 @@ def init_test_question(user_data, q_idx):
|
|
| 238 |
q_idx, d_idx, {},
|
| 239 |
gr.update(value=progress_q),
|
| 240 |
dim_title_update,
|
| 241 |
-
|
| 242 |
-
gr.update(value=append_cache_buster(question['audio'])),
|
| 243 |
prev_btn_update,
|
| 244 |
next_btn_update,
|
| 245 |
gr.update(value=None), # BUG FIX: Changed from "" to None to correctly clear the radio button
|
|
|
|
| 129 |
|
| 130 |
return selected, count_data
|
| 131 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 132 |
count_data = load_or_initialize_count_json(all_data_audio_paths)
|
| 133 |
selected_audio_paths, updated_count_data = sample_audio_paths(all_data_audio_paths, count_data, k=5)
|
| 134 |
|
|
|
|
| 171 |
def update_sample_view(dimension_title):
|
| 172 |
dim_data = next((d for d in DIMENSIONS_DATA if d["title"] == dimension_title), None)
|
| 173 |
if dim_data:
|
| 174 |
+
audio_up = gr.update(value=dim_data["audio"])
|
| 175 |
+
# audio_up = gr.update(value=append_cache_buster(dim_data["audio"]))
|
| 176 |
interactive_view_up = gr.update(visible=True)
|
| 177 |
reference_view_up = gr.update(visible=False)
|
| 178 |
reference_btn_up = gr.update(value="参考")
|
|
|
|
| 234 |
q_idx, d_idx, {},
|
| 235 |
gr.update(value=progress_q),
|
| 236 |
dim_title_update,
|
| 237 |
+
gr.update(value=question['audio']),
|
| 238 |
+
# gr.update(value=append_cache_buster(question['audio'])),
|
| 239 |
prev_btn_update,
|
| 240 |
next_btn_update,
|
| 241 |
gr.update(value=None), # BUG FIX: Changed from "" to None to correctly clear the radio button
|