Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -77,19 +77,22 @@ with gr.Blocks() as demo:
|
|
77 |
with gr.Box():
|
78 |
gr.Markdown("### ✍️ Gestion des Sections")
|
79 |
sections = gr.State(value=[])
|
|
|
|
|
|
|
|
|
80 |
sections_list = gr.Column() # Conteneur pour afficher les sections ajoutées
|
81 |
add_section_btn = gr.Button("+ Ajouter une Section ➕")
|
82 |
remove_section_btn = gr.Button("- Supprimer la dernière Section ➖")
|
83 |
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
add_section_btn.click(add_section, inputs=[sections], outputs=[sections_list])
|
88 |
-
remove_section_btn.click(remove_section, inputs=[sections], outputs=[sections_list])
|
89 |
|
90 |
with gr.Box():
|
91 |
gr.Markdown("### 🎧 Génération des Audios")
|
92 |
generate_btn = gr.Button("Générer les Audios ▶️")
|
|
|
93 |
results_output = gr.Column() # Conteneur pour afficher les audios générés
|
94 |
|
95 |
def generate_audios_and_display(project_name, sections, speaker):
|
@@ -104,16 +107,18 @@ with gr.Blocks() as demo:
|
|
104 |
|
105 |
with gr.Box():
|
106 |
gr.Markdown("### 📁 Sauvegarde du Projet")
|
|
|
107 |
save_project_btn = gr.Button("Sauvegarder le Projet ✅")
|
|
|
108 |
save_message = gr.Markdown("")
|
109 |
|
110 |
-
def save_project(project_name
|
111 |
project_path = os.path.join(output_folder, project_name)
|
112 |
if not os.path.exists(project_path):
|
113 |
return "⚠️ Aucun audio généré à sauvegarder."
|
114 |
return f"🎉 Projet '{project_name}' sauvegardé dans le dossier '{project_path}'."
|
115 |
|
116 |
-
save_project_btn.click(save_project, inputs=[project_name
|
117 |
|
118 |
# Lancement de l'interface
|
119 |
-
demo.launch(debug=True)
|
|
|
77 |
with gr.Box():
|
78 |
gr.Markdown("### ✍️ Gestion des Sections")
|
79 |
sections = gr.State(value=[])
|
80 |
+
|
81 |
+
def update_section_list(sections):
|
82 |
+
return [gr.Textbox(label=f"Nom : {s['name']}", value=s["text"], lines=2) for s in sections]
|
83 |
+
|
84 |
sections_list = gr.Column() # Conteneur pour afficher les sections ajoutées
|
85 |
add_section_btn = gr.Button("+ Ajouter une Section ➕")
|
86 |
remove_section_btn = gr.Button("- Supprimer la dernière Section ➖")
|
87 |
|
88 |
+
add_section_btn.click(add_section, inputs=[sections], outputs=[sections])
|
89 |
+
|
90 |
+
remove_section_btn.click(remove_section, inputs=[sections], outputs=[sections])
|
|
|
|
|
91 |
|
92 |
with gr.Box():
|
93 |
gr.Markdown("### 🎧 Génération des Audios")
|
94 |
generate_btn = gr.Button("Générer les Audios ▶️")
|
95 |
+
|
96 |
results_output = gr.Column() # Conteneur pour afficher les audios générés
|
97 |
|
98 |
def generate_audios_and_display(project_name, sections, speaker):
|
|
|
107 |
|
108 |
with gr.Box():
|
109 |
gr.Markdown("### 📁 Sauvegarde du Projet")
|
110 |
+
|
111 |
save_project_btn = gr.Button("Sauvegarder le Projet ✅")
|
112 |
+
|
113 |
save_message = gr.Markdown("")
|
114 |
|
115 |
+
def save_project(project_name):
|
116 |
project_path = os.path.join(output_folder, project_name)
|
117 |
if not os.path.exists(project_path):
|
118 |
return "⚠️ Aucun audio généré à sauvegarder."
|
119 |
return f"🎉 Projet '{project_name}' sauvegardé dans le dossier '{project_path}'."
|
120 |
|
121 |
+
save_project_btn.click(save_project, inputs=[project_name], outputs=[save_message])
|
122 |
|
123 |
# Lancement de l'interface
|
124 |
+
demo.launch(debug=True)
|