Update app.py
Browse files
app.py
CHANGED
@@ -41,35 +41,64 @@ def predict(prompt, speaker, agree, subfolder_name, file_name):
|
|
41 |
return output_path
|
42 |
|
43 |
custom_css = """
|
44 |
-
.gradio-container {
|
45 |
-
|
46 |
-
|
47 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
48 |
"""
|
49 |
|
50 |
-
title = "Synthèse Vocale XTTS
|
51 |
description = """
|
52 |
-
<h3>Bienvenue sur notre outil de synthèse vocale XTTS !</h3>
|
53 |
-
<p
|
54 |
"""
|
55 |
article = """
|
56 |
-
<div style='margin:20px auto; text-align: center;'>
|
57 |
-
<p>En utilisant cette démo, vous acceptez les
|
58 |
</div>
|
59 |
"""
|
60 |
|
61 |
available_speakers = list(set([f.split('_')[0] for f in os.listdir("examples") if f.endswith(".wav")]))
|
62 |
|
63 |
with gr.Blocks(css=custom_css) as demo:
|
64 |
-
gr.Markdown(f"<h1 style='text-align: center;'>{title}</h1>")
|
65 |
gr.Markdown(description)
|
|
|
66 |
with gr.Row():
|
67 |
with gr.Column(scale=2):
|
68 |
prompt = gr.Textbox(
|
69 |
label="Texte pour la synthèse vocale",
|
70 |
-
info="Une ou deux phrases à la fois sont préférables
|
71 |
placeholder="Bonjour ! Comment allez-vous aujourd'hui ?",
|
72 |
-
lines=
|
73 |
)
|
74 |
with gr.Column(scale=1):
|
75 |
speaker = gr.Dropdown(
|
@@ -89,8 +118,8 @@ with gr.Blocks(css=custom_css) as demo:
|
|
89 |
label="Nom du fichier (facultatif)",
|
90 |
placeholder="Nom du fichier audio généré"
|
91 |
)
|
92 |
-
generate_btn = gr.Button("Générer la voix", variant="primary")
|
93 |
|
|
|
94 |
audio_output = gr.Audio(label="Audio généré")
|
95 |
|
96 |
generate_btn.click(
|
@@ -101,4 +130,4 @@ with gr.Blocks(css=custom_css) as demo:
|
|
101 |
|
102 |
gr.Markdown(article)
|
103 |
|
104 |
-
demo.launch(debug=True)
|
|
|
41 |
return output_path
|
42 |
|
43 |
custom_css = """
|
44 |
+
.gradio-container {
|
45 |
+
font-family: 'Roboto', sans-serif;
|
46 |
+
background-color: #f7f9fc;
|
47 |
+
}
|
48 |
+
.gr-form {
|
49 |
+
background-color: white;
|
50 |
+
border-radius: 15px;
|
51 |
+
padding: 30px;
|
52 |
+
box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
|
53 |
+
}
|
54 |
+
.gr-button {
|
55 |
+
background-color: #4a90e2;
|
56 |
+
border: none;
|
57 |
+
color: white;
|
58 |
+
font-weight: bold;
|
59 |
+
transition: all 0.3s ease;
|
60 |
+
}
|
61 |
+
.gr-button:hover {
|
62 |
+
background-color: #3a7bc8;
|
63 |
+
transform: translateY(-2px);
|
64 |
+
}
|
65 |
+
.gr-input, .gr-dropdown {
|
66 |
+
border: 1px solid #e0e0e0;
|
67 |
+
border-radius: 8px;
|
68 |
+
padding: 10px;
|
69 |
+
}
|
70 |
+
.gr-checkbox {
|
71 |
+
margin-top: 10px;
|
72 |
+
}
|
73 |
+
.gr-form > div {
|
74 |
+
margin-bottom: 20px;
|
75 |
+
}
|
76 |
"""
|
77 |
|
78 |
+
title = "🎙️ Synthèse Vocale XTTS"
|
79 |
description = """
|
80 |
+
<h3 style='text-align: center; margin-bottom: 1em;'>Bienvenue sur notre outil de synthèse vocale XTTS !</h3>
|
81 |
+
<p style='text-align: center;'>Générez une voix naturelle à partir de votre texte en français. Choisissez une voix, entrez votre texte, et écoutez le résultat !</p>
|
82 |
"""
|
83 |
article = """
|
84 |
+
<div style='margin: 20px auto; text-align: center; padding: 10px; background-color: #e8f0fe; border-radius: 10px;'>
|
85 |
+
<p>En utilisant cette démo, vous acceptez les <a href='https://coqui.ai/cpml' target='_blank' style='color: #4a90e2; text-decoration: none;'>conditions d'utilisation du modèle Coqui Public</a></p>
|
86 |
</div>
|
87 |
"""
|
88 |
|
89 |
available_speakers = list(set([f.split('_')[0] for f in os.listdir("examples") if f.endswith(".wav")]))
|
90 |
|
91 |
with gr.Blocks(css=custom_css) as demo:
|
92 |
+
gr.Markdown(f"<h1 style='text-align: center; color: #4a90e2;'>{title}</h1>")
|
93 |
gr.Markdown(description)
|
94 |
+
|
95 |
with gr.Row():
|
96 |
with gr.Column(scale=2):
|
97 |
prompt = gr.Textbox(
|
98 |
label="Texte pour la synthèse vocale",
|
99 |
+
info="Une ou deux phrases à la fois sont préférables (max : 10)",
|
100 |
placeholder="Bonjour ! Comment allez-vous aujourd'hui ?",
|
101 |
+
lines=5
|
102 |
)
|
103 |
with gr.Column(scale=1):
|
104 |
speaker = gr.Dropdown(
|
|
|
118 |
label="Nom du fichier (facultatif)",
|
119 |
placeholder="Nom du fichier audio généré"
|
120 |
)
|
|
|
121 |
|
122 |
+
generate_btn = gr.Button("Générer la voix", variant="primary")
|
123 |
audio_output = gr.Audio(label="Audio généré")
|
124 |
|
125 |
generate_btn.click(
|
|
|
130 |
|
131 |
gr.Markdown(article)
|
132 |
|
133 |
+
demo.launch(debug=True)
|