NouFuS commited on
Commit
834ee4c
1 Parent(s): 8d4aa3e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +25 -25
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
- with gr.Tab("Voix (plus lent)"):
50
- voice = gr.Audio(sources=["microphone"], type="filepath")
51
-
52
- translation_button = gr.Button("Traduire votre enregistrement !")
 
 
 
 
 
53
  output_text = gr.Textbox(
54
- label="Texte traduit",
55
- info="Votre texte",
56
  lines=3,
57
  placeholder="Votre traduction",
58
  )
59
-
60
- speech_button = gr.Button("Générer audio !")
61
-
62
  translation_button.click(
63
- get_transcript,
64
  inputs=[
65
- voice
66
  ],
67
  outputs=[
68
  output_text
@@ -77,25 +80,23 @@ with gr.Blocks() as demo:
77
  gr.Audio(label="Output")
78
  ],
79
  )
80
- with gr.Tab("Texte (rapide)"):
81
- input_text = gr.Textbox(
82
- label="Input text",
83
- info="Your text",
84
- lines=3,
85
- placeholder="Écrire le texte à traduire",
86
- )
87
- translation_button = gr.Button("Traduire...")
88
  output_text = gr.Textbox(
89
- label="Output text",
90
- info="Your text",
91
  lines=3,
92
  placeholder="Votre traduction",
93
  )
94
- speech_button = gr.Button("Générer audio...")
 
 
95
  translation_button.click(
96
- get_translation,
97
  inputs=[
98
- input_text
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()