Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -46,23 +46,26 @@ def get_audio(text):
|
|
46 |
return speech["sampling_rate"], (speech["audio"]* 32767).astype(np.int16).T
|
47 |
|
48 |
with gr.Blocks() as demo:
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
|
|
|
|
|
|
|
|
|
|
53 |
output_text = gr.Textbox(
|
54 |
-
label="
|
55 |
-
info="
|
56 |
lines=3,
|
57 |
placeholder="Votre traduction",
|
58 |
)
|
59 |
-
|
60 |
-
speech_button = gr.Button("Générer audio !")
|
61 |
-
|
62 |
translation_button.click(
|
63 |
-
|
64 |
inputs=[
|
65 |
-
|
66 |
],
|
67 |
outputs=[
|
68 |
output_text
|
@@ -77,25 +80,23 @@ with gr.Blocks() as demo:
|
|
77 |
gr.Audio(label="Output")
|
78 |
],
|
79 |
)
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
lines=3,
|
85 |
-
placeholder="Écrire le texte à traduire",
|
86 |
-
)
|
87 |
-
translation_button = gr.Button("Traduire...")
|
88 |
output_text = gr.Textbox(
|
89 |
-
label="
|
90 |
-
info="
|
91 |
lines=3,
|
92 |
placeholder="Votre traduction",
|
93 |
)
|
94 |
-
|
|
|
|
|
95 |
translation_button.click(
|
96 |
-
|
97 |
inputs=[
|
98 |
-
|
99 |
],
|
100 |
outputs=[
|
101 |
output_text
|
@@ -110,5 +111,4 @@ with gr.Blocks() as demo:
|
|
110 |
gr.Audio(label="Output")
|
111 |
],
|
112 |
)
|
113 |
-
|
114 |
demo.launch()
|
|
|
46 |
return speech["sampling_rate"], (speech["audio"]* 32767).astype(np.int16).T
|
47 |
|
48 |
with gr.Blocks() as demo:
|
49 |
+
|
50 |
+
with gr.Tab("Texte (rapide)"):
|
51 |
+
input_text = gr.Textbox(
|
52 |
+
label="Input text",
|
53 |
+
info="Your text",
|
54 |
+
lines=3,
|
55 |
+
placeholder="Écrire le texte à traduire",
|
56 |
+
)
|
57 |
+
translation_button = gr.Button("Traduire...")
|
58 |
output_text = gr.Textbox(
|
59 |
+
label="Output text",
|
60 |
+
info="Your text",
|
61 |
lines=3,
|
62 |
placeholder="Votre traduction",
|
63 |
)
|
64 |
+
speech_button = gr.Button("Générer audio...")
|
|
|
|
|
65 |
translation_button.click(
|
66 |
+
get_translation,
|
67 |
inputs=[
|
68 |
+
input_text
|
69 |
],
|
70 |
outputs=[
|
71 |
output_text
|
|
|
80 |
gr.Audio(label="Output")
|
81 |
],
|
82 |
)
|
83 |
+
with gr.Tab("Voix (plus lent)"):
|
84 |
+
voice = gr.Audio(sources=["microphone"], type="filepath")
|
85 |
+
|
86 |
+
translation_button = gr.Button("Traduire votre enregistrement !")
|
|
|
|
|
|
|
|
|
87 |
output_text = gr.Textbox(
|
88 |
+
label="Texte traduit",
|
89 |
+
info="Votre texte",
|
90 |
lines=3,
|
91 |
placeholder="Votre traduction",
|
92 |
)
|
93 |
+
|
94 |
+
speech_button = gr.Button("Générer audio !")
|
95 |
+
|
96 |
translation_button.click(
|
97 |
+
get_transcript,
|
98 |
inputs=[
|
99 |
+
voice
|
100 |
],
|
101 |
outputs=[
|
102 |
output_text
|
|
|
111 |
gr.Audio(label="Output")
|
112 |
],
|
113 |
)
|
|
|
114 |
demo.launch()
|