Spaces:
Running
Running
Commit
·
06fc90d
1
Parent(s):
55b41e4
More app feedback
Browse files- Resources/localization.py +4 -0
- app.py +14 -4
Resources/localization.py
CHANGED
|
@@ -43,6 +43,8 @@ STRINGS = {
|
|
| 43 |
"invalid_time_format": "Invalid time format:",
|
| 44 |
"error": "Error:",
|
| 45 |
"all_videos_transcribed": "Save cancelled: All videos transcribed",
|
|
|
|
|
|
|
| 46 |
},
|
| 47 |
"uk": {
|
| 48 |
# Header and login
|
|
@@ -83,6 +85,8 @@ STRINGS = {
|
|
| 83 |
"invalid_time_format": "Невірний формат часу:",
|
| 84 |
"error": "Помилка:",
|
| 85 |
"all_videos_transcribed": "Відміна збереження: Усі відео розмічено",
|
|
|
|
|
|
|
| 86 |
}
|
| 87 |
}
|
| 88 |
|
|
|
|
| 43 |
"invalid_time_format": "Invalid time format:",
|
| 44 |
"error": "Error:",
|
| 45 |
"all_videos_transcribed": "Save cancelled: All videos transcribed",
|
| 46 |
+
"change_video_completion_status_success": "Video completion status successfully changed",
|
| 47 |
+
"show_incomplete_only_change": "List of accessible videos successfully changed"
|
| 48 |
},
|
| 49 |
"uk": {
|
| 50 |
# Header and login
|
|
|
|
| 85 |
"invalid_time_format": "Невірний формат часу:",
|
| 86 |
"error": "Помилка:",
|
| 87 |
"all_videos_transcribed": "Відміна збереження: Усі відео розмічено",
|
| 88 |
+
"change_video_completion_status_success": "Статус відео успішно змінено",
|
| 89 |
+
"show_incomplete_only_change": "Список доступних відео успішно змінено"
|
| 90 |
}
|
| 91 |
}
|
| 92 |
|
app.py
CHANGED
|
@@ -105,7 +105,11 @@ def cancel_edit():
|
|
| 105 |
|
| 106 |
def change_completion_status(completion_status):
|
| 107 |
global next_video_pointer
|
| 108 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 109 |
|
| 110 |
|
| 111 |
def get_next_components(show_incomplete_only):
|
|
@@ -193,7 +197,7 @@ with gr.Blocks(css=css, head=yt_init_js, fill_width=True) as main_page:
|
|
| 193 |
save_entry_button = gr.Button(get_string("save_entry_button"), variant="primary")
|
| 194 |
cancel_button = gr.Button(get_string("cancel_button"), variant="secondary")
|
| 195 |
|
| 196 |
-
|
| 197 |
|
| 198 |
main_page.load(
|
| 199 |
fn=get_next_components,
|
|
@@ -218,6 +222,11 @@ with gr.Blocks(css=css, head=yt_init_js, fill_width=True) as main_page:
|
|
| 218 |
outputs=editing_complete_checkbox
|
| 219 |
)
|
| 220 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 221 |
current_video_id.change(
|
| 222 |
fn=None,
|
| 223 |
inputs=current_video_id,
|
|
@@ -238,7 +247,8 @@ with gr.Blocks(css=css, head=yt_init_js, fill_width=True) as main_page:
|
|
| 238 |
|
| 239 |
editing_complete_checkbox.input(
|
| 240 |
fn=change_completion_status,
|
| 241 |
-
inputs=editing_complete_checkbox
|
|
|
|
| 242 |
)
|
| 243 |
|
| 244 |
add_entry_button.click(
|
|
@@ -250,7 +260,7 @@ with gr.Blocks(css=css, head=yt_init_js, fill_width=True) as main_page:
|
|
| 250 |
fn=save_entry,
|
| 251 |
inputs=[caption_editor, start_time_input, text_input, end_time_input,
|
| 252 |
selected_row_idx, current_video_id],
|
| 253 |
-
outputs=[caption_editor, editing_panel,
|
| 254 |
)
|
| 255 |
|
| 256 |
insert_start_time_button.click(
|
|
|
|
| 105 |
|
| 106 |
def change_completion_status(completion_status):
|
| 107 |
global next_video_pointer
|
| 108 |
+
try:
|
| 109 |
+
change_video_completion_status(completion_status, (next_video_pointer + n_videos - 1) % n_videos)
|
| 110 |
+
except Exception as e:
|
| 111 |
+
return gr.Error(f"{get_string('error')} {str(e)}")
|
| 112 |
+
return gr.Info(f'{get_string("change_video_completion_status_success")}')
|
| 113 |
|
| 114 |
|
| 115 |
def get_next_components(show_incomplete_only):
|
|
|
|
| 197 |
save_entry_button = gr.Button(get_string("save_entry_button"), variant="primary")
|
| 198 |
cancel_button = gr.Button(get_string("cancel_button"), variant="secondary")
|
| 199 |
|
| 200 |
+
info_window = gr.Markdown()
|
| 201 |
|
| 202 |
main_page.load(
|
| 203 |
fn=get_next_components,
|
|
|
|
| 222 |
outputs=editing_complete_checkbox
|
| 223 |
)
|
| 224 |
|
| 225 |
+
show_incomplete_only_checkbox.input(
|
| 226 |
+
fn=lambda: gr.Info(get_string("show_incomplete_only_change")),
|
| 227 |
+
outputs=info_window
|
| 228 |
+
)
|
| 229 |
+
|
| 230 |
current_video_id.change(
|
| 231 |
fn=None,
|
| 232 |
inputs=current_video_id,
|
|
|
|
| 247 |
|
| 248 |
editing_complete_checkbox.input(
|
| 249 |
fn=change_completion_status,
|
| 250 |
+
inputs=editing_complete_checkbox,
|
| 251 |
+
outputs=info_window
|
| 252 |
)
|
| 253 |
|
| 254 |
add_entry_button.click(
|
|
|
|
| 260 |
fn=save_entry,
|
| 261 |
inputs=[caption_editor, start_time_input, text_input, end_time_input,
|
| 262 |
selected_row_idx, current_video_id],
|
| 263 |
+
outputs=[caption_editor, editing_panel, info_window]
|
| 264 |
)
|
| 265 |
|
| 266 |
insert_start_time_button.click(
|