Spaces:
Sleeping
Sleeping
Brunwo
commited on
Commit
·
6bfae79
1
Parent(s):
b25e287
working theme, lang UI almost ok (changes applies ?)
Browse files- .gitignore +1 -0
- app.py +25 -13
- build.sh +1 -1
- locales/en/{messages.po → LC_MESSAGES/messages.po} +0 -0
.gitignore
CHANGED
@@ -4,3 +4,4 @@
|
|
4 |
pwa-report.json
|
5 |
server.pem
|
6 |
flagged/log.csv
|
|
|
|
4 |
pwa-report.json
|
5 |
server.pem
|
6 |
flagged/log.csv
|
7 |
+
.aider*
|
app.py
CHANGED
@@ -60,15 +60,6 @@ def update_language(lang):
|
|
60 |
# else:
|
61 |
# _ = lambda s: s # Default fallback, no translation
|
62 |
|
63 |
-
#reload instructions for podcast only (other templates are not affected)
|
64 |
-
INSTRUCTION_TEMPLATES["podcast"] = {
|
65 |
-
"intro": _("podcast.intro"),
|
66 |
-
"text_instructions": _("podcast.text_instructions"),
|
67 |
-
"scratch_pad": _("podcast.scratch_pad"),
|
68 |
-
"prelude": _("podcast.prelude"),
|
69 |
-
"dialog": _("podcast.dialog"),
|
70 |
-
}
|
71 |
-
return INSTRUCTION_TEMPLATES["podcast"]
|
72 |
|
73 |
update_language(lang='en')
|
74 |
|
@@ -127,6 +118,24 @@ INSTRUCTION_TEMPLATES = {
|
|
127 |
}
|
128 |
|
129 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
130 |
|
131 |
# Function to update instruction fields based on template selection
|
132 |
def update_instructions(template):
|
@@ -415,10 +424,7 @@ with gr.Blocks(theme='lone17/kotaemon', title="Text to Audio") as demo:
|
|
415 |
value="English",
|
416 |
info="Select the language for the interface.",
|
417 |
)
|
418 |
-
|
419 |
-
inputs=lang.value,
|
420 |
-
# outputs=[intro_instructions, text_instructions, scratch_pad_instructions, prelude_dialog, podcast_dialog_instructions]
|
421 |
-
)
|
422 |
submit_btn = gr.Button("Generate Audio")
|
423 |
|
424 |
with gr.Row():
|
@@ -533,6 +539,12 @@ with gr.Blocks(theme='lone17/kotaemon', title="Text to Audio") as demo:
|
|
533 |
outputs=[intro_instructions, text_instructions, scratch_pad_instructions, prelude_dialog, podcast_dialog_instructions]
|
534 |
)
|
535 |
|
|
|
|
|
|
|
|
|
|
|
|
|
536 |
submit_btn.click(
|
537 |
fn=validate_and_generate_audio,
|
538 |
inputs=[
|
|
|
60 |
# else:
|
61 |
# _ = lambda s: s # Default fallback, no translation
|
62 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
63 |
|
64 |
update_language(lang='en')
|
65 |
|
|
|
118 |
}
|
119 |
|
120 |
|
121 |
+
def update_instructions_language(lang):
|
122 |
+
update_language(lang)
|
123 |
+
#reload instructions for podcast only (other templates are not affected)
|
124 |
+
INSTRUCTION_TEMPLATES["podcast"] = {
|
125 |
+
"intro": _("podcast.intro"),
|
126 |
+
"text_instructions": _("podcast.text_instructions"),
|
127 |
+
"scratch_pad": _("podcast.scratch_pad"),
|
128 |
+
"prelude": _("podcast.prelude"),
|
129 |
+
"dialog": _("podcast.dialog"),
|
130 |
+
}
|
131 |
+
return (
|
132 |
+
INSTRUCTION_TEMPLATES["podcast"]["intro"],
|
133 |
+
INSTRUCTION_TEMPLATES["podcast"]["text_instructions"],
|
134 |
+
INSTRUCTION_TEMPLATES["podcast"]["scratch_pad"],
|
135 |
+
INSTRUCTION_TEMPLATES["podcast"]["prelude"],
|
136 |
+
INSTRUCTION_TEMPLATES["podcast"]["dialog"]
|
137 |
+
)
|
138 |
+
|
139 |
|
140 |
# Function to update instruction fields based on template selection
|
141 |
def update_instructions(template):
|
|
|
424 |
value="English",
|
425 |
info="Select the language for the interface.",
|
426 |
)
|
427 |
+
|
|
|
|
|
|
|
428 |
submit_btn = gr.Button("Generate Audio")
|
429 |
|
430 |
with gr.Row():
|
|
|
539 |
outputs=[intro_instructions, text_instructions, scratch_pad_instructions, prelude_dialog, podcast_dialog_instructions]
|
540 |
)
|
541 |
|
542 |
+
|
543 |
+
lang.change(fn=update_instructions_language,
|
544 |
+
inputs=[lang],
|
545 |
+
outputs=[intro_instructions, text_instructions, scratch_pad_instructions, prelude_dialog, podcast_dialog_instructions]
|
546 |
+
)
|
547 |
+
|
548 |
submit_btn.click(
|
549 |
fn=validate_and_generate_audio,
|
550 |
inputs=[
|
build.sh
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
msgfmt locales/fr/LC_MESSAGES/messages.po -o locales/fr/LC_MESSAGES/messages.mo
|
2 |
msgfmt locales/es/LC_MESSAGES/messages.po -o locales/es/LC_MESSAGES/messages.mo
|
3 |
-
msgfmt locales/
|
|
|
1 |
msgfmt locales/fr/LC_MESSAGES/messages.po -o locales/fr/LC_MESSAGES/messages.mo
|
2 |
msgfmt locales/es/LC_MESSAGES/messages.po -o locales/es/LC_MESSAGES/messages.mo
|
3 |
+
msgfmt locales/en/LC_MESSAGES/messages.po -o locales/en/LC_MESSAGES/messages.mo
|
locales/en/{messages.po → LC_MESSAGES/messages.po}
RENAMED
File without changes
|